home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
dm3_doc.zip
/
DM.DOC
< prev
next >
Wrap
Text File
|
1990-08-02
|
174KB
|
4,927 lines
M Y C R O F T R B B S D O O R I / O L I B R A R Y
Users Manual
for version 2.05 11/15/88
I M P O R T A N T
This document will be a floating document until all DMLIB 3.00
functions are implemented. I will do my best to keep it up to date.
During the "floating" period there will be no attempt to keep the
page numbers up to date.
L I S T O F C H A N G E S
The following is a listof changes asthey are made. This will measure
ourprogress toward a completed 3.xx.
04/06/90 Prelim 3.00 release
Interrupt or fossil driven i/o
Added format string to print_string()
Interrupt driven timer functions
T H I N G S T O C O M E
The following is a list of features/tasks to be completed in order of
precedence. Not all things are on the list, just the stuff that is
upcomming soon. Watch the BBS File Area #22 for updates to certain files
indicating an update.
1. Convertion to new user & bbs data structures. This will be mostly
an internal change but will have a few small effects on the "outside"
world.
2. Re-vamp DMIO. This will be split into several source files. Also
additional functions will be added as time permits.
3. Re-vamp DMBBS. This will get rid of the need for the old NODES.BBS
file. It will also add "local" login support for as many BBSs as
possible. Additional BBSs will also be supported at that time
along with several "generic" options.
4. Serialization and file protection utils & functions will be added.
5. External message files & functions to support multi-lingual door
support (more on this soon).
6. More stuff, to be announced later.....
X. After DMLIB 3.xx is complete, we will start to work on DMGLIB. This
will be an adon enhancement for allowing doors to run in graphics
modes. A special term program will be provided to run on the users
side. This term program will be generic and not "married" to a
single door. Plans are to support MONO, CGA, EGA, VGA, and 8514 for
IBM terms, plus a MAC and MAC windows support for the MAC term
program. For those of you who have access to and knowledge of other
computer systems, your help will be appreciated at that time.
i
T A B L E O F C O N T E N T S
(Note functions listed in lower case are either new or changed)
DISCLAIMER . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
USER NOTICE . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . x
I/O services . . . . . . . . . . . . . . . . . . . . . . . . . . . x
io_open . . . . . . . . . . . . . . . . . . . . . . . . . . . x
io_reopen. . . . .ReAquire comm port resources */
io_close . . . . .Release comm port resources */
dmcomm_init . . .Initialize comm port resources */
dmcomm_release . .Release comm port resources */
dmcomm_status . .Check low level input for data avail */
dmcomm_regs . . .Low level status registers */
dmcomm_input . . .Low level input */
dmcomm_output . .Low level output */
dmcomm_wait . . .Wait for output buffer empty */
dmcomm_iflush . .Flush low level input buffer */
dmcomm_oflush . .Flush low level output buffer */
MODEM_CARRIER . . . . . . . . . . . . . . . . . . . . . . . . x
MODEM_STATUS . . . . . . . . . . . . . . . . . . . . . . . . . x
MODEM_INPUT . . . . . . . . . . . . . . . . . . . . . . . . . x
MODEM_OUTPUT . . . . . . . . . . . . . . . . . . . . . . . . . x
modem_wait . . . .Wait for output to complete */
modem_iflush . . .Flush input buffer */
modem_oflush . . .Flush output buffer */
LOCAL_STATUS . . . . . . . . . . . . . . . . . . . . . . . . . x
LOCAL_INPUT . . . . . . . . . . . . . . . . . . . . . . . . . xx
LOCAL_CLS . . . . . . . . . . . . . . . . . . . . . . . . . . xx
LOCAL_OUTPUT . . . . . . . . . . . . . . . . . . . . . . . . . xx
LOCAL_BELL . . . . . . . . . . . . . . . . . . . . . . . . . . xx
LOCAL_PRINT . . . . . . . . . . . . . . . . . . . . . . . . . xx
local_wait . . . .Wait for output to complete */
local_iflush . . .Flush input buffer */
local_oflush . . .Flush output buffer */
GET_LOCAL_CURSOR . . . . . . . . . . . . . . . . . . . . . . . xx
SET_LOCAL_CURSOR . . . . . . . . . . . . . . . . . . . . . . . xx
SET_LOCAL_BANNER . . . . . . . . . . . . . . . . . . . . . . . xx
PUT_LOCAL_BANNER . . . . . . . . . . . . . . . . . . . . . . . xx
IO_STATUS . . . . . . . . . . . . . . . . . . . . . . . . . . xx
IO_TESTS . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
IO_INPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
IO_LINPUT . . . . . . . . . . . . . . . . . . . . . . . . . . xx
IO_LXINPUT . . . . . . . . . . . . . . . . . . . . . . . . . . xx
IO_LEXINPUT . . . . . . . . . . . . . . . . . . . . . . . . . xx
tio_input . . . .Read char (timed) */
tio_linput . . . .Read line with line feed (timed) */
tio_lxinput . . .Read line without line feed (timed) */
IO_PAUSE . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
EOL_DISPLAY . . . . . . . . . . . . . . . . . . . . . . . . . xx
CLS_DISPLAY . . . . . . . . . . . . . . . . . . . . . . . . . xx
CLS2_DISPLAY . . . . . . . . . . . . . . . . . . . . . . . . . xx
NO_CURSOR . . . . . . . . . . . . . . . . . . . . . . . . . . xx
SMALL_CURSOR . . . . . . . . . . . . . . . . . . . . . . . . . xx
MEDIUM_CURSOR . . . . . . . . . . . . . . . . . . . . . . . . xx
LARGE_CURSOR . . . . . . . . . . . . . . . . . . . . . . . . . xx
POSITION_CURSOR . . . . . . . . . . . . . . . . . . . . . . . xx
PRINT_CHAR . . . . . . . . . . . . . . . . . . . . . . . . . . xx
PRINT_CHARX . . . . . . . . . . . . . . . . . . . . . . . . . xx
BACKUP . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
print_string . . . . . . . . . . . . . . . . . . . . . . . . . xx
PRINT_METERED . . . . . . . . . . . . . . . . . . . . . . . . xx
PRINT_METEREDX . . . . . . . . . . . . . . . . . . . . . . . . xx
io_wait . . . . .Wait for output to complete */
io_iflush . . . .Flush input buffer */
io_oflush . . . .Flush output buffer */
dmread_ports . . .Read i/o definition file */
DOS services . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
FILE_OPEN . . . . . . . . . . . . . . . . . . . . . . . . . . xx
FILE_CLOSE . . . . . . . . . . . . . . . . . . . . . . . . . . xx
FILE_CHANGE . . . . . . . . . . . . . . . . . . . . . . . . . xx
FILE_RESET . . . . . . . . . . . . . . . . . . . . . . . . . . xx
set_dta . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
GET_DTA . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
FSEARCH . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
FHIDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
FUNHIDE . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
BBS services . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
read_bbs_info. . . . . . . . . . . . . . . . . . . . . . . . . xx
RBBS_READ . . . . . . . . . . . . . . . . . . . . . . . . . . xx
QBBS_READ . . . . . . . . . . . . . . . . . . . . . . . . . . xx
PCBBS_READ . . . . . . . . . . . . . . . . . . . . . . . . . . xx
PCBBS2_READ. . . . . . . . . . . . . . . . . . . . . . . . . . xx
WCBBS_READ . . . . . . . . . . . . . . . . . . . . . . . . . . xx
GBBS_READ . . . . . . . . . . . . . . . . . . . . . . . . . . xx
WBBS_READ . . . . . . . . . . . . . . . . . . . . . . . . . . xx
sfbbs_read . . . . . . . . . . . . . . . . . . . . . . . . . . xx
PAGE_OPERATOR . . . . . . . . . . . . . . . . . . . . . . . . xx
CHAT_MODE . . . . . . . . . . . . . . . . . . . . . . . . . . xx
Door Monitor services . . . . . . . . . . . . . . . . . . . . . . . xx
MON_READ . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
MON_WRITE . . . . . . . . . . . . . . . . . . . . . . . . . . xx
MON_PLAYER . . . . . . . . . . . . . . . . . . . . . . . . . . xx
MON_EXIT . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
Time services . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
dmtimer_open . . . . . . . . . . . . . . . . . . . . . . . . . xx
dmtimer_close. . . . . . . . . . . . . . . . . . . . . . . . . xx
delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
sleep . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
GET_DATE . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
CVT_DAYS . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
CUR_TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
CVT_TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . xx
TEST_TIMEOUT . . . . . . . . . . . . . . . . . . . . . . . . . xx
TIME_CONTROLS. . . . . . . . . . . . . . . . . . . . . . . . . xx
DAILY_CONTROLS . . . . . . . . . . . . . . . . . . . . . . . . xx
DM data structures. . . . . . . . . . . . . . . . . . . . . . . . . xx
File access structures . . . . . . . . . . . . . . . . . . . . xx
BBS access structures . . . . . . . . . . . . . . . . . . . . xx
Time control structures. . . . . . . . . . . . . . . . . . . . xxx
Monitor data structures. . . . . . . . . . . . . . . . . . . . xxx
User data structures . . . . . . . . . . . . . . . . . . . . . xxx
In closing . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxx
iii
DISCLAIMER
----------
This software is provided without any guarantee, either expressed or
implied. All responsibilities for its use rest with the user of the
software and not the author.
USER NOTICE
-----------
Now that that is out of the way, let me say that if you do find a
problem let me know by leaving me (the sysop) mail on Mycroft RBBS at
(408)927-0105 and I will try to help as much as possible.
Also, this software is not public domain, freeware, or shareware,
distribution without the express permission of the author is strictly
forbidden (and a rotten thing too).
Although not a requirement, I would appreciate if you would include the
following line as part of your game signon:
I/O and BBS functions provided by the Mycroft DM library.
Thanks and have fun.
1
Introduction
------------
DM is designed as an aid to programmers who wish to write door
applications for RBBS and PC-BOARD. Two versions of the library are
provided. The first version is compatible with Microsoft C Version
4.x. The second version is compatible with Microsoft C Version 5.x.
DM functions are broken down into five primary catagories. The first
provides a multitude of I/O functions for local, remote, and virtual
consoles. The second provides an easy interface to DOS file access
with full SHARE.EXE compatibility. The third set of functions provide
access to the BBS information for RBBS and PC-Board. The fourth group
provides an interface with both Bob Wescott's door monitor and the new
GMON door monitor. The last set provides some handy functions for
doing time maintenance in a BBS environment.
This manual will detail all of the DM functions along with the data
structure which they use. The following files should have been
included in your DM.ARC package:
DM.DOC This document
DM3.DOC Eventual document ToC
DM.LIB Microsoft 4.x DM library
DMDATA.H Data structure include file
DMFUNC.H Function Prototypes
MSTRMIND.C Sample door application (source)
MSTRMIND.HPN Sample door application (help file)
MSTRMIND.HPA Sample door application (help file)
MSTRMIND.HPG Sample door application (help file)
MSTRMIND.L Sample door application (link script)
TIMEGEN.EXE Time control file compiler
TIMES.DEF Sample time control source file
NODES.BBS Sample node definition file
Read through this manual once before attempting to write or modify any
code to use the DM functions. After that, use the manual as a
reference guide. Once you have conquered this task once, you will find
it easy to develop new doorware applications.
Most of the functions are provided in a format similar to that provided
by Microsoft for detailing its library functions.
2
I/O services
------------
The I/O services provide local, remote, and virtual I/O. They also
provide the programmer with functions to maintain the sysop's screen.
Screen addressing is based on the upper left hand corner of the screen
to be address (0, 0). A (x, y) address mode is used to specify a
location on the screen. The 'x' value is the column number, or the
horizontal axis, while the 'y' value is the row, or line number. The
routines do not provide error checking on the address given. If an
address is given outside of the screen space, unpredictable results
could follow with the current and future screen address functions.
The following section will detail all the I/O functions in the library.
Note that some of these functions are there as support for other
functions.
3
IO_OPEN
-------
* Summary
int io_open(node); /* Open the I/O library */
int node; /* The BBS node ID as passed in */
/* via the command line argument */
* Description
This function is provide to establish the remote environment that will
be used by the I/O functions. It must be called before any other I/O
function.
This function expects to find the file NODES.BBS in the directory
specified by the data structure value 'bbs_dir'.
If the node value passed in is '-1' then DM will assume it is running
in local mode.
The DM data structure 'remote_user' is set to 0 for a local connection
or to the comm port number for a remote connection.
* Return Value
0 is returned if function completed successfully.
-1 is returned if the file NODES.BBS cannot be found in the
directory specified in 'bbs_dir'.
-2 is returned if the appropriate node line cannot be read from the
file NODES.BBS.
-3 is returned if an invalid device is specified in the file
NODES.BBS.
4
* Example
#include "dmfunc.h"
int node; /* node id number */
int rtc; /* return code value */
/*
* Test command line arg[1] for a node number
*/
if (argc < 2) /* if no node number... */
io_open(-1); /* ...open as local console */
else { /* otherwise... */
node = atoi(argv[1]); /* convert node id to numeric */
if (node > 1) { /* if numeric... */
/*
* Process the open
*/
rtc = io_open(node); /* perform the open operation */
switch (rtc) { /* process return code */
case 0: /* all ok */
break;
case -1: /* no nodes.bbs file */
report_error("Error - Can't locate NODES.BBS\r\n");
exit(1);
break;
case -2: /* no node record in file */
report_error("Error - No node record\r\n");
exit(1);
break;
case -3: /* illegal device name in file */
report_error("Error - Illegal device\r\n");
exit(1);
break;
default: /* unexpected return code */
report_error("Error - Can't locate NODES.BBS\r\n");
exit(1);
break;
}
} else { /* otherwise... */
report_error("Error - Illegal node parameter\r\n");
exit(1);
}
}
/*
* DM is ready for I/O at this point
*/
5
MODEM_CARRIER
-------------
* Summary
int modem_carrier(); /* Test remote connection for */
/* carrier detect. */
* Description
This function will test the status of the comm port specified by the DM
data structure 'remote_user' for carrier detect. In the event that
'remote_user' is 0 (a local connection) a detect status is simulated.
* Return Value
0 is returned if running in local mode or if the remote comm port
still has an active carrier detect signal.
1 is returned if the remote connection has been dropped by the
modem and carrier detect is no longer true.
* Example
#include "dmfunc.h"
/*
* Test if remote is still active
*/
if (modem_carrier()) { /* if carrier detect lost.. */
report_error("Error - Loss of carrier detect,\r\n");
report_error(" Exiting to BBS.\r\n");
exit(2);
}
/*
* All is still OK at this point
*/
6
MODEM_STATUS
------------
* Summary
int modem_status(); /* Test for remote char available */
* Description
This function will test the status of the comm port specified by the DM
data structure 'remote_user' for an incoming keystroke. If operating
strictly as a local connection, 'remote_user' is 0, a false (0) value
is returned. Otherwise, if a character is ready for input, 2 is
returned.
* Return Value
0 is returned if running in local mode or if no remote characters
are available.
2 is returned if a remote keystroke is available.
* See Also
modem_input, local_status, local_input, io_status
* Example
#include "dmfunc.h"
int key; /* incoming keystroke */
/*
* If remote keystroke is present, then read it
*/
key = 0; /* assume no input */
if (modem_status()) /* if a keystroke is present */
key = modem_input(); /* get the remote keystroke */
7
MODEM_INPUT
-----------
* Summary
int modem_input(); /* Read remote character */
* Description
This function will input a character from the comm port specified by
the DM data structure 'remote_user' for an incoming keystroke. If
operating strictly as a local connection, 'remote_user' is 0, this
function should not be called. Always test for a character present by
using the 'modem_status' function first.
* Return Value
The input character is returned.
* See Also
modem_status, local_status, local_input
* Example
#include "dmfunc.h"
int key; /* incoming keystroke */
/*
* Loop until a remote char is present
*/
key = 0; /* assume no input */
while (modem_status() == 0); /* loop till char is there */
key = modem_input(); /* get the remote keystroke */
8
MODEM_OUTPUT
------------
* Summary
int modem_output(ch); /* Write remote character */
char ch; /* Character to output */
* Description
This function will output a character to the comm port specified by the
DM data structure 'remote_user'. If operating strictly as a local
connection, 'remote_user' is 0, this function will take no action.
Otherwise, the character is sent to the comm port. The character is
tested to see if it is a 'line feed', a hex 0x0A value. If so then the
number of nulls specified by the DM data structure 'user_nulls' are
also sent to the comm port.
* Return Value
This function always returns a 0.
* See Also
local_output
* Example
#include <string.h>
#include "dmfunc.h"
int i; /* work variable */
char message[] = "Hello\r\n"; /* a message */
/*
* Print a string to remote stream
*/
for (i = 0; i < strlen(message); i++)
modem_output(message[i]);
9
LOCAL_STATUS
------------
* Summary
int local_status(); /* Get local keyboard status */
* Description
This function will test the local keyboard for the presence of a
keystroke.
* Return Value
0 if no local keystroke is present
1 if a local keystroke is present
* See Also
local_input, modem_status, modem_input, io_status
* Example
#include "dmfunc.h"
int key; /* keyboard character */
/*
* Wait for local keystroke then input it
*/
while (local_status() == 0); /* wait for a key */
key = local_input(); /* get the input */
10
LOCAL_INPUT
-----------
* Summary
int local_input(); /* Get a local keyboard char */
* Description
This function will wait for a local keystroke to be entered. If the
keystroke is a special SysOp key then it will be processed and a null
character will be returned. Otherwise, the local character is
returned. The following SysOp keys are supported:
Alt F1 Eject user.
Right Arrow Add 1 minute to users time.
Left Arrow Subtract 1 minute from users time.
F4 Annoy toggle.
F6 Available toggle.
F9 Snoop toggle.
F10 Force CHAT mode.
* Return Value
The function returns 0 if a SysOp key is pressed, else, the character
code striped to 7 bits is returned.
* See Also
modem_input, local_status, modem_status
* Example
#include "dmfunc.h"
int key; /* keyboard character */
/*
* Wait for local keystroke then input it
*/
while (local_status() == 0); /* wait for a key */
key = local_input(); /* get the input */
11
LOCAL_CLS
---------
* Summary
int local_cls(); /* Clear the local display screen */
* Description
This function will clear the local display screen and set the local
cursor to (0,0). This function has no effect on the remote terminal.
* Return Value
This function always returns a 0.
* See Also
cls_display, cls2_display, eol_display
* Example
#include "dmfunc.h"
int key; /* keyboard character */
/*
* Clear the local display and then wait for a local keystroke
*/
local_cls(); /* clear the display */
key = local_input(); /* wait for and get local key */
12
LOCAL_OUTPUT
------------
* Summary
int local_output(data); /* Output char to local display */
int data; /* Character to output */
* Description
This function will display the character passed to the function at the
current display position of the local display. No action is taken if
the DM data structure 'bbs_node_info.snoop' is set to ' 1'.
If the output character is a line feed then this function will perform
screen scrolling if necessary to prevent the future output from
entering the banner area.
If the output character is a bell character and the DM data structure
remote_user is non zero, then the bell character is not output.
* Return Value
This function always returns a 0.
* See Also
modem_output
* Example
#include <string.h>
#include "dmfunc.h"
int i; /* work variable */
char message[] = "This is it.\r\n"; /* a sample message */
/*
* Print a message on the local display
*/
for (i = 0; i < strlen(message); i++)
local_output(message[i]);
13
LOCAL_BELL
----------
* Summary
int local_bell(); /* Output bell to local display */
* Description
This function will output a bell character to the local dsiplay.
* Return Value
This function always returns a 0.
* See Also
modem_output
* Example
#include <string.h>
#include "dmfunc.h"
int i;
/*
* Fatal crash error, alarm the SysOp
*/
local_print("Fatal error - Data files are corrupted!");
for(i = 0 ; i < 16 ; i++)
local_bell();
14
LOCAL_PRINT
-----------
* Summary
int local_print(string); /* Output string to local display */
char *string; /* Pointer to output string */
* Description
This function will display the string passed to the function at the
current display position of the local display. No action is taken if
the DM data structure 'bbs_node_info.snoop' is not set to ' 1'.
If the output string contains a line feed, then this function will
perform screen scrolling if necessary to prevent the future output from
entering the banner area.
* Return Value
This function always returns a 0.
* See Also
local_output, modem_output, print_char, print_charx,
print_string, print_metered, print_meteredx
* Example
#include "dmfunc.h"
/*
* Print a message on the local display
*/
local_print("This is a local message\r\n");
15
GET_LOCAL_CURSOR
----------------
* Summary
int get_local_cursor(x, y); /* Get the local cursor position */
int *x; /* Pointer to x coordinate */
int *y; /* Pointer to y coordinate */
* Description
This function will return the current x & y locations of the local
displays cursor. It is primarily used as an internal function, but may
be useful since both the local and remote cursor will usually be at the
same location.
* Return Value
This function always returns a 0.
* See Also
set_local_cursor, position_cursor
* Example
#include "dmfunc.h"
int x, y; /* coordinates of the cursor */
/*
* Print a message on the local display
*/
get_local_cursor(&x, &y); /* save the current location */
set_local_cursor(0, 24); /* go to banner line
*/
local_print("This is a local message\r\n");
set_local_cursor(x, y); /* restore cursor location */
16
SET_LOCAL_CURSOR
----------------
* Summary
int set_local_cursor(x, y); /* Set the local cursor position */
int x; /* X coordinate of new location */
int y; /* Y coordinate of new location */
* Description
This function will move the local cursor to the location specified by
the x & y parameters. It is primarily used as an internal function,
but may be useful to put a local message up at a desired location.
* Return Value
This function always returns a 0.
* See Also
get_local_cursor, position_cursor
* Example
#include "dmfunc.h"
int x, y; /* coordinates of the cursor */
/*
* Print a message on the local display
*/
get_local_cursor(&x, &y); /* save the current location */
set_local_cursor(0, 24); /* go to banner line
*/
local_print("This is a local message\r\n");
set_local_cursor(x, y); /* restore cursor location */
17
SET_LOCAL_BANNER
----------------
* Summary
int set_local_banner(string, f, b);
/* Setup the local banner line */
char *string; /* Pointer to banner message */
int f; /* Foreground color of banner */
int b; /* Background color of banner */
* Description
This function will do all the setup work for the banner line displayed
on the SysOp's bottom display line. The text string should usually
include the users name, the game title, and the game version number.
The string is expected to be 80 characters in length.
See the data structures & includes section for a description of
allowable foreground and background color definitions.
* Return Value
This function always returns a 0.
* See Also
put_local_banner
18
* Example
#include "dmfunc.h"
int i, x; /* work variables */
char banner[81]; /* string to build banner in */
char title[] = "The Game"; /* title of the game */
char vers[] = "V1.00"; /* version number of the game */
/*
* Setup & display the local banner
*/
/* fill banner with spaces */
for (i = 0; i < 80; i++)
banner[i] = ' ';
/* fill in user name */
for (i = 0; i < strlen(user_name); i++)
banner[i] = user_name[i];
/* center the game title */
x = 40 - (strlen(title) / 2);
for (i = 0; i < strlen(title); i++)
banner[x + i] = title[i];
/* right justify version # */
x = 79 - strlen(vers);
for (i = 0; i < strlen(vers); i++)
banner[x + i] = vers[i];
set_local_banner(banner, WHITE, CYAN);
put_local_banner();
19
PUT_LOCAL_BANNER
----------------
* Summary
int put_local_banner(); /* Display banner on local screen */
* Description
This function will display the previously setup banner on line 24 of
the local display. The current cursor position is automatically saved
and restored by the function.
If the DM data structure 'bbs_node_info.snoop' is not set to ' 1', then
no action will take place.
* Return Value
This function always returns a 0.
* See Also
set_local_banner
* Example
See example under set_local_banner.
20
IO_STATUS
---------
* Summary
int io_status(); /* Get virtual console status */
* Description
This function will return the status of the virtual console. The
virtual console may be either the local console, the remote console, or
both, depending upon the states of the DM data structures
'remote_user' and 'bbs_node_info.snoop'.
* Return Value
0 if no data is available.
1 if local data is available.
2 if remote data is available.
* See Also
modem_status, local_status
* Example
#include "dmfunc.h"
int status; /* virtual status */
int key; /* virtual character */
/*
* Wait for virtual char, then process it
*/
status = 0; /* initialize */
while (status == 0) /* wait for a character */
status = io_status();
if (status == 1) /* get the input */
key = local_input();
else
key = remote_input();
21
IO_TESTS
--------
* Summary
int io_tests(); /* Test virtual console for error */
* Description
This function will return an error code if there is a problem on the
virtual console. It tests for loss of carrier and time related
problems. The function never returns an error if the virtual console
is only attached to the local console.
* Return Value
0 if no errors.
-1 if carrier has been dropped.
-2 if there has been no keyboard activity for 5 minutes.
-3 if there is less than 5 minutes of connect time.
-4 if all connect time has been used.
22
* Example
#include "dmfunc.h"
int status; /* virtual status */
/*
* Test for & report virtual errors
*/
status = io_tests(); /* test for errors */
switch (status) { /* report if error */
case 0: /* No errors */
break;
case -1:/* No carrier */
local_print("Error - Loss of carrier\r\n");
exit(1);
break;
case -2:/* No activity */
local_print("Error - No activity for 5 minutes\r\n");
exit(1);
break;
case -3:/* Time warning */
local_print("Warning - Less than 5 minutes connect time\r\n");
break;
case -4:/* Time error */
local_print("Error - All connect time has been used\r\n");
exit(1);
break;
}
23
IO_INPUT
--------
* Summary
int io_input(); /* Get virtual console character */
* Description
This function will wait for and return a character from the virtual
console. It tests for loss of carrier and time related problems. The
function never returns an error if the virtual console is only attached
to the local console.
* Return Value
-1 if carrier has been dropped.
-2 if there has been no keyboard activity for 5 minutes.
-3 if there is less than 5 minutes of connect time.
-4 if all connect time has been used.
otherwise input character is returned.
* See Also
modem_input, local_input, modem_status, modem_status, io_status
24
* Example
#include "dmfunc.h"
int key; /* virtual input */
/*
* Get a char, test for & report virtual errors
*/
key = io_input(); /* get a character */
switch (status) { /* report if error */
case 0: /* No errors */
break;
case -1: /* No carrier */
local_print("Error - Loss of carrier\r\n");
exit(1);
break;
case -2: /* No activity */
local_print("Error - No activity for 5 minutes\r\n");
exit(1);
break;
case -3: /* Time warning */
local_print("Warning - Less than 5 minutes connect time\r\n");
break;
case -4: /* Time error */
local_print("Error - All connect time has been used\r\n");
exit(1);
break;
default: /* Regular input */
/* ... process input ... */
break;
}
25
IO_LINPUT, IO_LXINPUT, IO_LEXINPUT
----------------------------------
* Summary
int io_linput(buff); /* Get virtual console line with */
/* terminating carriage return */
int io_lxinput(buff); /* Get virtual console line without */
/* terminating carriage return */
int io_lexinput(buff); /* Get virtual console line without */
/* terminating CR or echo */
char buff[80]; /* 80 character line buffer */
* Description
All three functions will wait for and return a line of data from the
virtual console. It tests for loss of carrier and any time related
problems. The function never returns an error if the virtual console
is only attached to the local console.
Characters are echoed to the virtual console as entered in all but the
io_lexinput function. Carriage return line feed sequence is echoed upon
receipt of a terminating carriage return character with io_linput, but
not with io_lxinput or io_lexinput. These functions support editing
using the backspace key and calls the virtual I/O functions for support
of the SysOp keys.
* Return Value
Both functions always returns a 0, but the return string may contain
one of the following error strings:
"~NO_CARRIER"
"~NOT_ACTIVE"
"~TIME_WARNING"
"~TIMEOUT"
If none of these strings are returned then the users input is returned
as a null terminated string.
* See Also
modem_input, local_input
26
* Example
#include "dmfunc.h"
char buffer[80]; /* input buffer */
/*
* Get a command string, test for & report virtual errors
*/
io_linput(buffer); /* get a command string */
if (strcmp(buffer, "~NO_CARRIER") == 0) {
/* Loss of carrier */
local_print("Error - Loss of carrier\r\n");
exit(1);
} else
if (strcmp(buffer, "~NOT_ACTIVE") == 0) {
/* Lack of activity */
local_print("Error - No activity for 5 minutes\r\n");
exit(1);
} else
if (strcmp(buffer, "~TIME_WARNING") == 0) {
/* Running out of time */
local_print("Warning - Less than 5 minutes connect time\r\n");
exit(1);
} else
if (strcmp(buffer, "~TIMEOUT") == 0) {
/* Out of time */
local_print("Error - All connect time has been used\r\n");
exit(1);
} else {
/* ... process user command ... */
}
27
IO_PAUSE
--------
* Summary
int io_pause(string, flag); /* Print a string & wait for ENTER */
char *string; /* Pointer to message to output */
int flag; /* Centering flag 0 = Left margin */
/* 1 = Centered */
* Description
This function will display a message on the virtual console and then
wait for an ENTER key to be entered from the virtual console. The
function will abort in the event of loss of carrier or timeouts. The
flag controls whether or not to center the message.
After the ENTER key is received, a carriage return line feed sequence
is issued if the remote console is a printing device or it will backup
and erase the message if not.
* Return Value
This function always returns a 0.
* Example
#include "dmfunc.h"
/*
* Print a prompt to continue (centered)
*/
io_pause("Press [ENTER] to continue...", 1);
28
EOL_DISPLAY
-----------
* Summary
int eol_display(); /* Erase virtual to end of line */
* Description
This function will erase the virtual console from the current cursor
position to the end of line. This function only works if the DM data
structure 'user_graphics' is set to 2 indicating ANSI support.
* Return Value
This function always returns a 0.
* See Also
cls_display, cls2_display, local_cls
* Example
#include "dmfunc.h"
int i;
/*
* Erase the message section of the virtual console
* (lines 18-22 are erased (note screen is base 0))
*/
for (i = 17; i < 22; i++) {
position_cursor(0, i);
eol_display();
}
29
CLS_DISPLAY, CLS2_DISPLAY
-------------------------
* Summary
int cls_display(); /* Clear virtual display */
* Description
These functions will erase the virtual console. If the DM data
structure 'user_graphics' is set to 2 then the screen is cleared via an
ANSI escape sequence. Otherwise, cls_display sends 25 line feeds to
the display, and cls2_display sends 3 line feeds.
* Return Value
These functions always returns a 0.
* See Also
cls2_display, local_cls, eol_display
* Example
#include "dmfunc.h"
/*
* Clear the screen
*/
cls_display();
30
NO_CURSOR, SMALL_CURSOR, MEDIUM_CURSOR, LARGE_CURSOR
----------------------------------------------------
* Summary
int no_cursor(); /* Turn off local cursor */
int small_cursor(); /* Set local cursor to underline */
int medium_cursor(); /* Set local cursor to half block */
int large_cursor(); /* Set local cursor to full block */
* Description
These functions will set the cursor size on the local console. The
remote console is totally unaffected by these functions.
* Return Value
These functions always returns a 0.
* Example
#include "dmfunc.h"
/*
* Turn off local cursor
*/
no_cursor();
31
POSITION_CURSOR
---------------
* Summary
int position_cursor(x, y); /* Position virtual cursor */
int x; /* X coordinate (base 0) Column */
int y; /* Y coordinate (base 0) Line */
* Description
This function will position the cursor on the virtual console. The
function only works if the DM data structure 'user_graphics' is set to
2. Otherwise, the function does nothing. The cursor positioning is
done via an ANSI escape sequence.
* Return Value
This function always returns a 0.
* See Also
set_local_cursor, get_local_cursor
* Example
#include "dmfunc.h"
/*
* Issue an error message on line 24 of display
*/
position_cursor(0, 23); /* set position on 24th line */
print_string("Error - Illegal command.");
32
PRINT_CHAR, PRINT_CHARX
-----------------------
* Summary
int print_char(character); /* Print char to virtual display */
int print_charx(character); /* Print char to virtual display */
/* without backspace interpretation. */
char character; /* Character to print */
* Description
Both functions will display the passed in character at the current
cursor position on the virtual display. Backspace interpretation (hex
code 08) is performed with print_char, while it is not with
print_charx. If the remote display is active and a line feed is
issued, then the appropriate number of nulls are sent if the DM data
structure 'mon_nulls' is set to a value greater than 0.
The DM data structure 'user_caps' is also checked to see if the output
character must be forced to upper case.
* Return Value
This function always returns a 0.
* Example
#include "dmfunc.h"
int i; /* work variable */
char message[] = "Hello"; /* a sample message */
/*
* Issue a message at current position
*/
for (i = 0; i < strlen(message); i++)
print_char(message[i]);
33
BACKUP
------
* Summary
int backup(count); /* Issue bksps to virtual display */
int count; /* Number of backspaces to issue */
* Description
This function will erase character from the current cursor position of
the virtual display.
* Return Value
This function always returns a 0.
* Example
#include "dmfunc.h"
char message[] = "Error - bad command";
/*
* Issue a self destructive error message
*/
position_cursor(0, 24); /* go to desired location */
print_string(message); /* issue the message */
sleep(3); /* delay */
backup(strlen(message); /* now destroy it */
34
PRINT_STRING
------------
* Summary
int print_string(string); /* Issue message to virtual display */
char *message; /* Pointer to message to print */
* Description
This function will display the passed string on the virtual console.
Backspace and line feed interpretation are performed.
* Return Value
This function always returns a 0.
* Example
#include <stdio.h>
#include "dmfunc.h"
int eline; /* error line number */
int error; /* error code */
char message[80]; /* message buffer */
/*
* Issue a self destructive error message
*/
position_cursor(0, 24); /* go to desired location */
sprintf(message, "Error %d in line %d", error, eline);
print_string(message); /* issue the message */
sleep(3); /* delay */
backup(strlen(message); /* now destroy it */
35
PRINT_METERED
-------------
* Summary
int print_metered(line, str, buff);
/* Issue message to virtual display */
int *line; /* Pointer to line counter */
char *str; /* Pointer to message to print */
char *buff; /* Pointer to 80 char input buffer */
* Description
This function will display the passed in string on the virtual console.
In addition, it will allow the output to be metered so that the display
will pause and allow the user to read the information without it having
scrolled of the screen. It is designed primarily to be used with help
and instruction files.
After displaying the message, the line count is incremented. If it is
greater than or equal to one less than the value in the DM data
structure 'user_page', then the following message is displayed centered
on the virtual console:
Continue [Y], N, NS...
The program will then pause and wait for a response from the virtual
console. The responses will determine the return code from the
function.
* Return Value
0 is returned is the user entered a carriage return or a Y.
1 is returned is the user entered a NS.
2 is returned is the user entered a N.
-1 is returned in all other cases.
* See Also
print_meteredx
36
* Example
#include "dmfunc.h"
int control; /* loop output control */
int line; /* line counter */
int max_line; /* total lines to output */
int rtc; /* return code */
char help_info[100][80]; /* help information array */
char buffer[80]; /* 80 char input buffer */
/*
* Display the help information
*/
control = 0; /* set loop controller */
line = 0; /* start with line 0 */
max_line = 0;
while ((control < 2) && (max_line < 100)) {
/* Print function is dependant on
* whether NS has been pressed or not
*/
if (control) /* if the NS has been entered */
print_string(message[max_line]);
else /* otherwise */
rtc = print_metered(&line, message[max_line], buffer);
if (rtc == 1) /* NS has been pressed */
control = 1;
else
if (rtc == 2) /* N has been pressed, abort */
control = 2;
/*
* Here a call to a error checking routine
* is made to watch for loss of carrier
* or timeouts.
*/
if (check_error(buffer))
exit(1);
/*
* Else do next line
*/
max_line++;
}
37
PRINT_METEREDX
--------------
* Summary
int print_meteredx(line, str, buf);
/* Issue message to virtual display */
int *line; /* Pointer to line counter */
char *str; /* Pointer to message to print */
char *buf; /* Pointer to 80 char input buffer */
* Description
This function will display the passed in string on the virtual console.
In addition, it will allow the output to be metered so that the display
will pause and allow the user to read the information without it having
scrolled off the screen. It is designed primarily to be used with help
and instruction files.
Unlike the 'print_metered' function, this function does not supply the
user with the ability to turn off the metering or to abort the display.
The DM data structure 'user_page' is also used here to monitor the line
count. The metering pause message for this function is:
Press [ENTER] to continue...
The program will then pause and wait for a response from the virtual
console. The responses will determine the return code for the
function.
* Return Value
0 is returned if the user entered a carriage return.
-1 is returned in all other cases.
38
* Example
int print_meteredx(); /* print on the virtual display */
int control; /* loop output control */
int line; /* line counter */
int max_line; /* total lines to output */
int rtc; /* return code */
char login_info[100][80]; /* login information array */
char buffer[80]; /* 80 char input buffer */
/*
* Display the login information
*/
control = 0; /* set loop controller */
line = 0; /* start with line 0 */
max_line = 0;
while ((control == 0) && (max_line < 100)) {
rtc = print_metered(&line, message[max_line], buffer);
/*
* Here a call to a error checking routine
* is made to watch for loss of carrier
* or timeouts.
*/
if (rtc) {
if (check_error(buffer))
exit(1);
}
/*
* Else do next line
*/
max_line++;
}
39
DOS services
------------
The DOS services provide the programmer with a simple way to implement
SHARE.EXE compatible code for multi-node BBS. Also functions are
provided to allow searching the disk for files.
All file access is done via a file structure. The FS access structure
is detailed in the chapter on DM data structures.
Files should always be open for read-only unless the open is to just
write to the file. Whenever you need to write to a file that is open,
make a call to the 'file_change' function, do the write, and then reset
the file back to read only using the 'file_reset' function.
Files are always opened in both direct and stream mode and thus you may
use whichever mode you prefer when accessing them. It is recommended
that you access files in direct mode whenevr possible though as stream
I/O is not guaranteed to be acurate under shared file access.
The following section will detail all the DOS functions in the library.
Note that some of these functions are there as support for other
functions.
40
FILE_OPEN
---------
* Summary
int file_open(file, rw, mode, cf);
/* Open a file for sharing */
FS *file; /* Pointer to file structure */
int rw; /* Read/write access control */
/* (0) FREAD read only */
/* (1) FMODIFY read/write */
/* (2) FAPPEND append */
/* (3) FWRITE write only */
int mode; /* File mode access control */
/* (0) FTEXT text file */
/* (1) FBINARY binary file */
int cf; /* File creation control */
/* (0) FNOCREATE */
/* (1) FCREATE */
* Description
This function is the most complex of the file sharing functions. In
general, the filename is copied to the appropriate section of the FS
structure and the function call is made.
If the FNOCREATE parameter is passed, then the file must exist on disk
or the function will fail. If the FCREATE parameter is used, the
functions action will be based on the 'rw' parameter. The following
actions are taken based on this parameter:
FREAD Open existing file, error if not present.
FMODIFY Open existing file, create if not present.
FAPPEND Open existing file, create if not present.
FWRITE Delete any existing file, create new file.
It is suggested that the files used for read/write or read/append
access be opened using the FREAD parameter and that the 'file_change'
and 'file_reset' functions be used when it comes time to write to it.
This method will provide the proper interaction with SHARE.EXE and will
avoid other BBS nodes from being denied access to the file.
Also, when modifying sections of a record, the record should be re-read
after the 'file_change' function is called to guarantee the integrity
of the file.
41
* Return Value
0 is returned if function completed successfully.
-1 is returned if an attempt made to create an existing file.
-2 is returned if no file handles are available.
-3 is returned if an attempt is made to open an existing file and
the file cannot be found.
-4 is returned if the file cannot be successfully opened in stream
access mode.
-5 is returned if the file is share locked. This return code is
only returned after several attempts were made to open the file.
This usually indicates that either a program section is leaving
the file set for writing too long or has failed to make the call
to 'file_reset'.
* See Also
file_close, file_change, file_reset
* Example
See the example in file_reset for proper use of all the file
functions.
42
FILE_CLOSE
----------
* Summary
int file_close(file); /* Close a shared file */
FS *file; /* Pointer to file structure */
* Description
This function is used to close a file that was open in share mode. The
file is closed for both direct and stream access.
* Return Value
This function always returns 0.
* See Also
file_open, file_change, file_reset
* Example
FS rfile; /* file access structure */
int file_close(); /* close a shared file */
/*
* Close the help file
*/
file_close(&rfile);
43
FILE_CHANGE
-----------
* Summary
int file_change(file, rw, md, cf);
/* Change shared file access */
FS *file; /* Pointer to file structure */
int rw; /* Read/write access control */
/* (0) FREAD read only */
/* (1) FMODIFY read/write */
/* (2) FAPPEND append */
/* (3) FWRITE write only */
int md; /* File mode access control */
/* (0) FTEXT text file */
/* (1) FBINARY binary file */
int cf; /* File creation control */
/* (0) FNOCREATE */
/* (1) FCREATE */
* Description
Once you have mastered the 'file_open' function, you will find this
function simple to use. All parameters are identical to the
'file_open' function.
This function will close the specified file while saving its current
mode, access type, and position. The file is then reopened in the new
mode and access type. Use the 'file_reset' function to return it back
to its previous state & position.
The creation control parameter is ignored unless the file was not open
when this function is invoked.
If the FNOCREATE parameter is passed, then the file must exist on disk
or the function will fail. If the FCREATE parameter is used then the
functions action will be based on the 'rw' parameter. The following
actions are taken based on this parameter:
FREAD Open existing file, error if not present.
FMODIFY Open existing file, create if not present.
FAPPEND Open existing file, create if not present.
FWRITE Delete any existing file, create new file.
It is suggested the files that are used for read/write or read/append
access be opened using the FREAD parameter and that the 'file_change'
and 'file_reset' functions be used when it comes time to write to it.
This method will provide the proper interaction with SHARE.EXE and will
avoid other BBS nodes from being denied access to the file.
Also, when modifying sections of a record, the record should be re-read
after the 'file_change' function is called to guarantee the integrity
of the file.
44
* Return Value
0 is returned if function completed successfully.
-1 is returned if an attempt made to create an existing file.
-2 is returned if no file handles are available. This can be cured
by changing the files parameter in the system CONFIG.SYS file.
-3 is returned if an attempt is made to open an existing file and
the file cannot be found.
-4 is returned if the file cannot be successfully opened in stream
access mode.
-5 is returned if the file is share locked. This return code is
only returned after several attempts were made to open the file.
This usually indicates that either a program section is leaving
the file set for writing too long or has failed to make the call
to 'file_reset'.
* See Also
file_open, file_close, file_reset
* Example
See example in file_reset for proper use of all file functions.
45
FILE_RESET
----------
* Summary
int file_reset(file); /* Restore shared file access */
FS *file; /* Pointer to file structure */
* Description
This function assumes that a file was already open and the function
'file_change' has been called, otherwise, unpredictable results may
occur.
This function will close the specified file thus flushing all buffers.
The file is then reopened back in its original access mode, and then
the file is repositioned to its original location.
It is suggested the files that are used for read/write or read/append
access be opened using the FREAD parameter and that the 'file_change'
and 'file_reset' functions be used when it comes time to write to it.
This method will provide the proper interaction with SHARE.EXE and will
avoid other BBS nodes from being denied access to the file.
Also when modifying sections of a record, the record should be re-read
after the 'file_change' function is called to guarantee the integrity
of the file.
Return values are identical to the 'file_open' function since it is
recalled to open the file back up in its previous mode.
* Return Value
0 is returned if function completed successfully.
-1 is returned if an attempt made to create an existing file.
-2 is returned if no file handles are available. This can be cured
by changing the files parameter in the system CONFIG.SYS file.
-3 is returned if an attempt is made to open an existing file and
the file cannot be found.
-4 is returned if the file cannot be successfully opened in stream
access mode.
-5 is returned if the file is share locked. This return code is
only returned after several attempts were made to open the file.
This usually indicates that either a program section is leaving
the file set for writing too long or has failed to make the call
to 'file_reset'.
* See Also
file_close, file_change, file_open
46
* Example
#include <string.h>
#include <io.h>
#include <stdio.h>
#include "dmdata.h"
#include "dmfunc.h"
void show_error(int rtc); /* print out file error messages. */
FS rfile; /* file access structure */
int rtc; /* return code value */
char buffer[128]; /* record buffer */
/*
* Open the record file for reading in binary mode
*/
strcpy(rfile.name, "GAME.REC"); /* setup filename */
if (rtc = file_open(&rfile, FREAD, FBINARY, FNOCREATE))
show_error(rtc);
/*
* Now change access to modify access
*/
if (rtc = file_change(&rfile, FMODIFY, FBINARY, FNOCREATE))
show_error(rtc);
/*
* Now go to record 0 and read it in
* to guarantee the record is current
*/
lseek(rfile.fh, 0L, 0); /* position at record 0 */
read(rfile.fh, buff, 128); /* read in 128 byte record */
/*
* Update the record with the date
*/
get_date(buff); /* copy in current date */
write(rfile.fh, buff, 128); /* now write it back out */
/*
* Now return to read mode
*/
if (rtc = file_reset(rfile))
show_error(rtc);
file_close(rfile);
47
void show_error(rtc)
{
switch(rtc) { /* process return code */
case 0: /* all ok */
return;
case -1: /* create error */
report_error("Error - File already exists\r\n");
exit(1);
case -2: /* no handles */
report_error("Error - All file handles in use\r\n");
exit(1);
case -3: /* file not found */
report_error("Error - File not found\r\n");
exit(1);
case -4: /* stream unavailable */
report_error("Error - Stream access denied\r\n");
exit(1);
case -5: /* file locked */
report_error("Error - File is locked\r\n");
exit(1);
default: /* unexpected return code */
report_error("Error - Bad return code from file_open()\r\n");
exit(1);
}
}
48
GET_DTA
-------
* Summary
char *get_dta(); /* Get disk transfer address */
* Description
This function is used to return the DOS current disk transfer address.
It is primarily used as an internal function but it is made available
to you.
* Return Value
This function always returns 0.
* Example
#include "dmfunc.h"
char *dta; /* the transfer address */
/*
* Get the DOS disk transfer address
*/
dta = get_dta();
49
FSEARCH
-------
* Summary
int fsearch(name, buffer); /* Search disk for files */
char *name; /* Match name string pointer */
char *buffer; /* Buffer to store file list */
* Description
This function is equivalent to doing a DIR command in DOS. The name
parameter is the name you wish to search against and may include
standard wildcard characters.
Buffer is filled with a series of null terminated file names that have
matched the name parameter. Buffer should be allocated to accommodate
all matched file names.
* Return Value
0 if no files match.
Otherwise returns the number of matches.
* Example
#include "dmfunc.h"
int count; /* number of matches */
int total; /* number of matches */
char sname[80]; /* the match name to search on */
char buffer[2048]; /* large match buffer */
char *names; /* filename pointer */
/*
* Get all .DAT files
*/
strcpy(sname, "*.DAT"); /* build search name */
count = fsearch(sname, buffer); /* now do the search */
/*
* Report results
*/
names = buffer; /* name pointer */
total = count; /* total matches */
print_string("\r\n"); /* new line */
while(count) { /* do as long as we have names */
print_string(names); /* print next filename */
names += strlen(names) + 1; /* point to next name */
count--; /* one less to do */
}
sprintf(sname, "Total file(s) %d found\r\n"), total);
print_string(sname);
50
FHIDE
-----
* Summary
int fhide(name); /* Hide the specified file */
char *name; /* Name of file to hide */
* Description
This function will set the hide attribute bit in the specified file.
This function should not be formed on open files.
* Return Value
Undefined return value.
* Example
#include "dmfunc.h"
/*
* Hide the file
*/
fhide("SECRET.DAT"); /* hide the file */
51
FUNHIDE
-------
* Summary
int funhide(name); /* UnHide the specified file */
char *name; /* Name of file to hide */
* Description
This function will clear the hide attribute bit in the specified file.
This function should not be formed on open files.
* Return Value
Undefined return value.
* Example
#include "dmfunc.h"
/*
* UnHide the file
*/
funhide("SECRET.DAT"); /* unhide the file */
52
BBS services
------------
The BBS services provide a simple means for the programmer to access
all of the required BBS parameters without needing any knowledge of the
BBS files.
All file access is done using SHARE.EXE compatible file access so as to
remain compatible in a multi-user environment.
The following section will detail all the BBS functions in the library.
Note that some of these functions may be there as support for other
functions.
53
READ_BBS_INFO
-------------
* Summary
int read_bbs_info(node, path, type);
int node; /* BBS node number */
char *path; /* Path where BBS files reside */
char *type; /* BBS type identifier */
* Description
This function is an overall BBS access functions. It may be used in
liew of calling the other functions independantly.
First, this function will attempt to call the remote comm port by
making a call to IO_OPEN. An error is returned if this function fails.
Next, it initializes the C randon number generator by calling the DM
function RANDOM_CLOCK and then calling the C function SRAND.
Next, the DM data structure bbs_path is set to contain the value passed
in in the path parameter.
Next, the type parameter is scanned for a recognizable BBS type. If
a match is found then the appropriate bbs function is called. See the
descriptions of the individual functions to see what files each expects
to find and read.
The following list show the parameters for the path & type strings:
path type function called
----------------------------------------------------------------------
RBBS file path NULL BBS_READ (15.x)
RBBS file path RBBS RBBS_READ (16.x)
Quick BBS file path QBBS QBBS_READ
PC-Board file path PCBOARD PCBBS_READ (12.1)
PC-Board file path PCBOARD14 PCBBS_READ (14.0)
Wildcat file path WILDCAT WCBBS_READ
GAP BBS file path GAP GBBS_READ
NULL NULL MON_READ
MON_USER
54
* Return Value
Returns 0 if all ok
===== Comm Port Return Codes =====
Returns -1 if can't find NODES.BBS file
Returns -2 if can't read node record
Returns -3 if can't identify comm port device
===== RBBS 15.x Return Codes =====
Returns -11 if can't find MESSAGES file
Returns -12 if can't read node record
Returns -13 if can't find USERS files
Returns -14 if can't read user record
Returns -15 if can't find PASSWRDS file
Returns -16 if can't read security level record
===== RBBS 16.x Return Codes =====
Returns -21 if can't find MESSAGES file
Returns -22 if can't read node record
Returns -23 if can't find DORINFOx files
Returns -24 if can't read user record
===== PC-Board Return Codes =====
Returns -31 if can't find PCBOARD.SYS info
Returns -32 if can't read PCBOARD.SYS info
===== Wildcat Return Codes =====
Returns -41 if can't find CALLINFO.BBS info
Returns -42 if can't read CALLINFO.BBS info
===== QBBS Return Codes =====
Returns -51 if can't find DORINFOx.DEF info
Returns -52 if can't read DORINFOx.DEF info
===== GAP Return Codes =====
Returns -51 if can't find DOOR.SYS info
Returns -52 if can't read DOOR.SYS info
===== WWIV Return Codes =====
Returns -51 if can't find CHAIN.TXT info
Returns -52 if can't read CHAIN.TXT info
===== Door Monitor Return Codes =====
Returns -101 if can't find TIMEOFFx.DOR
Returns -102 if can't find or read NAMES.DOR
===== Misc Return Codes =====
Returns 1 if bad type parameter
55
* Example
#include "dmfunc.h"
int rtc; /* return code value */
int node; /* current node */
/*
* Read in the BBS information
*/
node = atoi(argv[1]); /* get node number from cmd line */
rtc = read_bbs_info(node, argv[2], argv[3]);
switch(rtc) { /* process return code */
case 0: /* all ok */
break;
case -1: /* cant' locate NODES.BBS */
report_error("Error - Can't locate NODES.BBS\r\n");
exit(1);
case -2: /* can't read node record */
report_error("Error - Can't read node record in NODES.BBS\r\n");
exit(1);
case -3: /* can't identify device */
report_error("Error - Invalid device in NODES.BBS\r\n");
exit(1);
case -11:/* can't find MESSAGES */
report_error("Error - Can't locate MESSAGES\r\n");
exit(1);
case -12:/* can't read MESSAGES */
report_error("Error - Can't read node record in MESSAGES\r\n");
exit(1);
case -13:/* can't locate USERS */
report_error("Error - Can't locate USERS\r\n");
exit(1);
case -14:/* can't read USERS */
report_error("Error - Can't read USERS\r\n");
exit(1);
case -15:/* can't locate PASSWRDS */
report_error("Error - Can't locate PASSWRDS\r\n");
exit(1);
case -16:/* can't read PASSWRDS */
report_error("Error - Can't read security record in PASSWRDS\r\n");
exit(1);
56
case -21:/* can't find MESSAGES */
report_error("Error - Can't locate MESSAGES\r\n");
exit(1);
case -22:/* can't read MESSAGES */
report_error("Error - Can't read node record in MESSAGES\r\n");
exit(1);
case -23:/* can't locate DORINFOx.DEF */
report_error("Error - Can't locate DORINFOx.DEF\r\n");
exit(1);
case -24:/* can't read DORINFOx.DEF */
report_error("Error - Can't read DORINFOx.DEF\r\n");
exit(1);
case -31:/* can't find PCBOARD.SYS */
report_error("Error - Can't locate PCBOARD.SYS\r\n");
exit(1);
case -32:/* can't read PCBOARD.SYS */
report_error("Error - Can't read record in PCBOARD.SYS\r\n");
exit(1);
case -41:/* can't find CALLINFO.BBS */
report_error("Error - Can't locate CALLINFO.BBS\r\n");
exit(1);
case -42:/* can't read CALLINFO.BBS */
report_error("Error - Can't read record in CALLINFO.BBS\r\n");
exit(1);
case -51:/* can't find DORINFOx.DEF */
report_error("Error - Can't locate DORINFOx.DEF\r\n");
exit(1);
case -52:/* can't read DORINFOx.DEF */
report_error("Error - Can't read record in DORINFOx.DEF\r\n");
exit(1);
case -61:/* can't find DOOR.SYS */
report_error("Error - Can't locate DOOR.SYS\r\n");
exit(1);
case -62:/* can't read DOOR.SYS */
report_error("Error - Can't read record in DOOR.SYS\r\n");
exit(1);
case -71:/* can't find CHAIN.TXT */
report_error("Error - Can't locate CHAIN.TXT\r\n");
exit(1);
case -72:/* can't read CHAIN.TXT */
report_error("Error - Can't read record in CHAIN.TXT\r\n");
exit(1);
case -101:/* can't access TIMEOFFx.DOR */
report_error("Error - Can't access TIMEOFFx.DOR\r\n");
exit(1);
case -102:/* can't access DORINFOx.DEF */
report_error("Error - Can't access NAMES.DOR\r\n");
exit(1);
default: /* unexpected return code */
report_error("Error - Undefined return code from read_bbs_info()\r\n");
exit(1);
}
/*
* At this point all is OK
*/
print_string("Welcome, ");
print_string(user_name);
print_string(", to the game.\r\n");
57
BBS_READ
--------
* Summary
int bbs_read(node); /* Read in the RBBS information */
int node; /* RBBS node number */
* Description
This function will read in all RBBS 15.1A/15.1B compatible data
structures. This function will also work the 16.1x version, but new
functions will be added in the near future to take advantage of the BBS
Door Information File generated by RBBS 16.
All bbs files (MESSAGES, USERS, PASSWRDS) are assumed to exist in the
subdirectory specified by the DM data structure 'bbs_dir'.
First, the MESSAGES file is opened and the appropriate node record is
read into the DM data structure 'bbs_node_info'. An error is returned
if the file cannot be located or if the node record is not found. The
users name and logon time are extracted and saved in the DM data
structures 'user_name' and 'user_signon'.
Next, the USERS file is opened and searched for the current user. An
error is returned if the file cannot be located or if the users record
cannot be found. The users security level, graphics type, nulls flag,
caps flag, and page length are transferred to the DM data structures
'user_security', 'user_graphics', 'user_nulls', 'user_caps', and
'user_page' respectively. The DM data structure 'user_signon' is then
modified to reflect the amount of time the user has already used that
day.
Next, the PASSWRDS files is opened and searched for the corresponding
entry that matches the users security level. An error is returned if
either the file cannot be located or there is no corresponding time
entry that matches the users security level. The DM data structure
'user_signoff' is then set to reflect the amount of time the user has
remaining in connect time.
* Return Value
0 is returned if function completed successfully.
-1 is returned if the MESSAGES file cannot be located.
-2 is returned if the node record in MESSAGES cannot be read.
-3 is returned if the USERS file cannot be located.
-4 is returned if the current users record cannot be read.
-5 is returned if the PASSWRDS file cannot be located.
-6 is returned if the security level record cannot be read.
58
* Example
#include "dmfunc.h"
int rtc; /* return code value */
int node; /* current node */
/*
* Read in the RBBS information
*/
node = atoi(argv[1]); /* get node number from cmd line */
strcpy(bbs_dir, argv[2]); /* get bbs path from cmd line */
rtc = bbs_read(node); /* read bbs information */
switch(rtc) { /* process return code */
case 0: /* all ok */
break;
case -1: /* cant' locate MESSAGES */
report_error("Error - Can't locate MESSAGES\r\n");
exit(1);
case -2: /* can't locate node record */
report_error("Error - Can't locate node record in MESSAGES\r\n");
exit(1);
case -3: /* can't locate USERS */
report_error("Error - Can't locate USERS\r\n");
exit(1);
case -4: /* can't find users record */
report_error("Error - Can't locate user record\r\n");
exit(1);
case -5: /* can't locate PASSWRDS */
report_error("Error - Can't locate PASSWRDS\r\n");
exit(1);
case -6: /* can't locate security level record */
report_error("Error - Can't locate security record\r\n");
exit(1);
default: /* unexpected return code */
report_error("Error - Unexpected return code from bbs_read()\r\n");
exit(1);
}
/*
* At this point all is OK
*/
print_string("Welcome, ");
print_string(user_name);
print_string(", to the game.\r\n");
59
RBBS_READ
---------
* Summary
int rbbs_read(node); /* Read in the RBBS information */
int node; /* RBBS node number */
* Description
This function will read in all RBBS 16.1A compatible data structures.
All bbs files (MESSAGES, DORINFOx.DEF) are assumed to exist in the
subdirectory specified by the DM data structure 'bbs_dir'.
First, the MESSAGES file is opened and the appropriate node record is
read into the DM data structure 'bbs_node_info'. An error is returned
if the file cannot be located or if the node record is not found. The
users name and logon time are extracted and saved in the DM data
structures 'user_name' and 'user_signon'.
Next, DORINFOx.DEF is opened and read into a temporary data structure.
An error is returned if the file cannot be located or if the file can't
be read to completion. The users name, security level, and graphics
type are extracted and stored in appropriate data structures. Values
undefined by these files are set to default values (see section on
default data values).
* Return Value
0 is returned if function completed successfully.
-1 is returned if the MESSAGES file cannot be located.
-2 is returned if the node record in MESSAGES cannot be read.
-3 is returned if the DORINFOx.DEF file cannot be located.
-4 is returned if the DORINFOx.DEF cannot be read to completion.
60
* Example
#include "dmfunc.h"
int rtc; /* return code value */
int node; /* current node */
/*
* Read in the RBBS information
*/
node = atoi(argv[1]); /* get node number from cmd line */
strcpy(bbs_dir, argv[2]); /* get bbs path from cmd line */
rtc = rbbs_read(node); /* read bbs information */
switch(rtc) { /* process return code */
case 0: /* all ok */
break;
case -1: /* cant' locate MESSAGES */
report_error("Error - Can't locate MESSAGES\r\n");
exit(1);
case -2: /* can't locate node record */
report_error("Error - Can't locate node record in MESSAGES\r\n");
exit(1);
case -3: /* can't locate DORINFOx.DEF */
report_error("Error - Can't locate DORINFOx.DEF\r\n");
exit(1);
case -4: /* can't read DORINFOx.DEF */
report_error("Error - Can't read DORINFOx.DEF\r\n");
exit(1);
default: /* unexpected return code */
report_error("Error - Unexpected return code from rbbs_read()\r\n");
exit(1);
}
/*
* At this point all is OK
*/
print_string("Welcome, ");
print_string(user_name);
print_string(", to the game.\r\n");
61
QBBS_READ
---------
* Summary
int qbbs_read(node); /* Read in the QBBS information */
int node; /* RBBS node number */
* Description
This function will read in all RBBS 16.1A compatible data structures.
The bbs file DORINFOx.DEF is assumed to exist in the subdirectory
specified by the DM data structure 'bbs_dir'.
The DORINFOx.DEF is opened and read into a temporary data structure.
An error is returned if the file cannot be located or if the file can't
be read to completion. The users name, security level, and graphics
type are extracted and stored in appropriate data structures. Values
undefined by this files are set to default values (see section on
default data values).
* Return Value
0 is returned if function completed successfully.
-1 is returned if the DORINFOx.DEF file cannot be located.
-2 is returned if the DORINFOx.DEF cannot be read to completion.
62
* Example
#include "dmfunc.h"
int rtc; /* return code value */
int node; /* current node */
/*
* Read in the RBBS information
*/
node = atoi(argv[1]); /* get node number from cmd line */
strcpy(bbs_dir, argv[2]); /* get bbs path from cmd line */
rtc = qbbs_read(node); /* read bbs information */
switch(rtc) { /* process return code */
case 0: /* all ok */
break;
case -1: /* can't locate DORINFOx.DEF */
report_error("Error - Can't locate DORINFOx.DEF\r\n");
exit(1);
case -2: /* can't read DORINFOx.DEF */
report_error("Error - Can't read DORINFOx.DEF\r\n");
exit(1);
default: /* unexpected return code */
report_error("Error - Unexpected return code from qbbs_read()\r\n");
exit(1);
}
/*
* At this point all is OK
*/
print_string("Welcome, ");
print_string(user_name);
print_string(", to the game.\r\n");
63
PCBBS_READ
----------
* Summary
int pcbbs_read(node); /* Read in the PCB 12.1 information */
int node; /* BBS node number */
* Description
This function will read in the PCBOARD.SYS file and then transfer all
related information into the DM data structure 'bbs_node_info'. All
user parameters are copied into the DM data structures beginning with
'user_'. See 'bbs_read' for details.
The DM data structure 'pcbbs_data' is used to hold the incoming info,
but is not used after that.
The file PCBOARD.SYS is expected to reside in subdirectory specified by
the DM data structure 'bbs_dir'.
* Return Value
0 is returned if function completed successfully.
-1 is returned if the PCBOARD.SYS file cannot be located.
-2 is returned if the PCBOARD.SYS file cannot be read.
64
* Example
int pcbbs_read(); /* open & read PCBOARD.SYS */
int rtc; /* return code value */
int node; /* current node */
/*
* Read in the PC-Board information
*/
node = atoi(argv[1]); /* get node number from cmd line */
strcpy(bbs_dir, argv[2]); /* get bbs path from cmd line */
rtc = pcbbs_read(node); /* read bbs information */
switch(rtc) /* process return code */
{
case 0: /* all ok */
break;
case -1: /* cant' locate PCBOARD.SYS */
report_error("Error - Can't locate PCBOARD.SYS\r\n");
exit(1);
case -2: /* can't read PCBOARD.SYS */
report_error("Error - Can't read PCBOARD.SYS\r\n");
exit(1);
default: /* unexpected return code */
report_error("Error - Bad return code from pcbbs_read()\r\n");
exit(1);
}
/*
* At this point all is OK
*/
print_string("Welcome, ");
print_string(user_name);
print_string(", to the game.\r\n");
65
PCBBS2_READ
-----------
* Summary
int pcbbs2_read(node); /* Read in the PCB 14.0 information */
int node; /* BBS node number */
* Description
This function will read in the PCBOARD.SYS file and then transfer all
related information into the DM data structure 'bbs_node_info'. All
user parameters are copied into the DM data structures beginning with
'user_'. See 'bbs_read' for details.
The DM data structure 'pcbbs2_data' is used to hold the incoming info,
but is not used after that.
The file PCBOARD.SYS is expected to reside in subdirectory specified by
the DM data structure 'bbs_dir'.
* Return Value
0 is returned if function completed successfully.
-1 is returned if the PCBOARD.SYS file cannot be located.
-2 is returned if the PCBOARD.SYS file cannot be read.
66
* Example
int pcbbs2_read(); /* open & read PCBOARD.SYS */
int rtc; /* return code value */
int node; /* current node */
/*
* Read in the PC-Board information
*/
node = atoi(argv[1]); /* get node number from cmd line */
strcpy(bbs_dir, argv[2]); /* get bbs path from cmd line */
rtc = pcbbs2_read(node); /* read bbs information */
switch(rtc) /* process return code */
{
case 0: /* all ok */
break;
case -1: /* cant' locate PCBOARD.SYS */
report_error("Error - Can't locate PCBOARD.SYS\r\n");
exit(1);
case -2: /* can't read PCBOARD.SYS */
report_error("Error - Can't read PCBOARD.SYS\r\n");
exit(1);
default: /* unexpected return code */
report_error("Error - Bad return code from pcbbs_read()\r\n");
exit(1);
}
/*
* At this point all is OK
*/
print_string("Welcome, ");
print_string(user_name);
print_string(", to the game.\r\n");
67
WCBBS_READ
----------
* Summary
int wcbbs_read(node); /* Read in the Wildcat information */
int node; /* BBS node number */
* Description
This function will read in the CALLINFO.BBS file and then transfer all
related information into the DM data structure 'bbs_node_info'. All
user parameters are copied into the DM data structures beginning with
'user_'. See 'bbs_read' for details.
The DM data structure 'wcbbs_data' is used to hold the incoming info,
but is not used after that.
The file CALLINFO.BBS is expected to reside in subdirectory specified
by the DM data structure 'bbs_dir'.
* Return Value
0 is returned if function completed successfully.
-1 is returned if the CALLINFO.BBS file cannot be located.
-2 is returned if the CALLINFO.BBS file cannot be read.
68
* Example
int wcbbs_read(); /* open & read CALLINFO.BBS */
int rtc; /* return code value */
int node; /* current node */
/*
* Read in the Wildcat BBS information
*/
node = atoi(argv[1]); /* get node number from cmd line */
strcpy(bbs_dir, argv[2]); /* get bbs path from cmd line */
rtc = wcbbs_read(node); /* read bbs information */
switch(rtc) /* process return code */
{
case 0: /* all ok */
break;
case -1: /* cant' locate CALLINFO.BBS */
report_error("Error - Can't locate CALLINFO.BBS\r\n");
exit(1);
case -2: /* can't read CALLINFO.BBS */
report_error("Error - Can't read CALLINFO.BBS\r\n");
exit(1);
default: /* unexpected return code */
report_error("Error - Bad return code from wcbbs_read()\r\n");
exit(1);
}
/*
* At this point all is OK
*/
print_string("Welcome, ");
print_string(user_name);
print_string(", to the game.\r\n");
69
GBBS_READ
---------
* Summary
int gbbs_read(node); /* Read in the GAP BBS information */
int node; /* BBS node number */
* Description
This function will read in the DOOR.SYS file and then transfer all
related information into the DM data structure 'bbs_node_info'. All
user parameters are copied into the DM data structures beginning with
'user_'. See 'bbs_read' for details.
The DM data structure 'gbbs_data' is used to hold the incoming info,
but is not used after that.
The file DOOR.SYS is expected to reside in subdirectory specified by
by the DM data structure 'bbs_dir'.
* Return Value
0 is returned if function completed successfully.
-1 is returned if the DOOR.SYS file cannot be located.
-2 is returned if the DOOR.SYS file cannot be read.
70
* Example
int gbbs_read(); /* open & read DOOR.SYS */
int rtc; /* return code value */
int node; /* current node */
/*
* Read in the GAP BBS information
*/
node = atoi(argv[1]); /* get node number from cmd line */
strcpy(bbs_dir, argv[2]); /* get bbs path from cmd line */
rtc = gbbs_read(node); /* read bbs information */
switch(rtc) /* process return code */
{
case 0: /* all ok */
break;
case -1: /* cant' locate DOOR.SYS */
report_error("Error - Can't locate DOOR.SYS\r\n");
exit(1);
case -2: /* can't read DOOR.SYS */
report_error("Error - Can't read DOOR.SYS\r\n");
exit(1);
default: /* unexpected return code */
report_error("Error - Bad return code from gbbs_read()\r\n");
exit(1);
}
/*
* At this point all is OK
*/
print_string("Welcome, ");
print_string(user_name);
print_string(", to the game.\r\n");
71
WBBS_READ
---------
* Summary
int wbbs_read(node); /* Read in the WWIV BBS information */
int node; /* BBS node number */
* Description
This function will read in the CHAIN.TXT file and then transfer all
related information into the DM data structure 'bbs_node_info'. All
user parameters are copied into the DM data structures beginning with
'user_'. See 'bbs_read' for details.
The DM data structure 'ascii_data' is used to hold the incoming info,
but is not used after that.
The file CHAIN.TXT is expected to reside in subdirectory specified by
by the DM data structure 'bbs_dir'.
* Return Value
0 is returned if function completed successfully.
-1 is returned if the CHAIN.TXT file cannot be located.
-2 is returned if the CHAIN.TXT file cannot be read.
72
* Example
int wbbs_read(); /* open & read CHAIN.TXT */
int rtc; /* return code value */
int node; /* current node */
/*
* Read in the GAP BBS information
*/
node = atoi(argv[1]); /* get node number from cmd line */
strcpy(bbs_dir, argv[2]); /* get bbs path from cmd line */
rtc = wbbs_read(node); /* read bbs information */
switch(rtc) /* process return code */
{
case 0: /* all ok */
break;
case -1: /* cant' locate DOOR.SYS */
report_error("Error - Can't locate CHAIN.TXT\r\n");
exit(1);
case -2: /* can't read DOOR.SYS */
report_error("Error - Can't read CHAIN.TXT\r\n");
exit(1);
default: /* unexpected return code */
report_error("Error - Bad return code from gbbs_read()\r\n");
exit(1);
}
/*
* At this point all is OK
*/
print_string("Welcome, ");
print_string(user_name);
print_string(", to the game.\r\n");
73
PAGE_OPERATOR
-------------
* Summary
int page_operator(); /* Page the SysOp */
* Description
This function will allow the user to page the SysOp. If the DM data
structure 'remote_user' is 0, then the function will return a 'no
answer' response.
The DM data structures 'bbs_time_info.sysop_start' and
'bbs_time_info.sysop_stop' are checked to identify the SysOp's working
hours.
If the DM data structure 'bbs_node_info.sysop_avail' is set to ' 1'
then a test is made to verify that the current time falls within the
SysOp's working hours. If the 'bbs_node_info.sysop_annoy' is set to '
1' then the page is also allowed.
If the page is allowed then the local bell will be rung 10 times in
order to attempt to reach the SysOp. If the SysOp wishes to answer the
page, he/she presses the ESC button on the local keyboard and the
message "SysOp in, go ahead..." will be printed to the virtual console.
* Return Value
0 is returned if there is no answer to the page or if the page is
not currently permitted.
1 is returned if the SysOp answered the page.
74
* Example
#include "dmfunc.h"
int rtc; /* return code value */
char buffer[80]; /* command buffer */
/*
* Get next user command.
*/
io_linput(buffer); /* get a command string */
if (strcmp(buffer, "~NO_CARRIER") == 0) {
/* Loss of carrier */
local_print("Error - Loss of carrier\r\n");
exit(1);
} else
if (strcmp(buffer, "~NOT_ACTIVE") == 0) {
/* Loss of carrier */
local_print("Error - No activity for 5 minutes\r\n");
exit(1);
} else
if (strcmp(buffer, "~TIME_WARNING") == 0) {
/* Loss of carrier */
local_print("Warning - Less than 5 minutes connect time\r\n");
exit(1);
} else
if (strcmp(buffer, "~TIMEOUT") == 0) {
/* Loss of carrier */
local_print("Error - All connect time has been used\r\n");
exit(1);
} else
if (strcmp(strupr(buffer), "PAGE") == 0) {
/* Page the operator */
rtc = page_operator(); /* attempt to page the SysOp */
if (rtc)
chat_mode(); /* chat with user */
else
print_string("Sorry, the SysOp is not available.\r\n");
} else {
/* ... process other user commands ... */
}
75
CHAT_MODE
---------
* Summary
int chat_mode(); /* Enter CHAT mode */
* Description
This function will allow the SySop to initiate CHAT mode. In this
mode, characters entered from the virtual console are echoed back to
it. CHAT mode continues until an ESC character is entered from the
local console.
The 'chat_mode' function does not test for end-of-line condition and
therefore the SysOp and remote user will need to use the ENTER key to
go to the next line as word wrap is not supported.
* Return Value
This function always returns a 0.
* Example
See example under page_operator for proper use of chat_mode.
76
Door Monitor services
---------------------
The door monitor services provide a simple to access all of the
required door monitor parameters without needing any knowledge of the
door monitor files. It also provides a means of returning the time and
score information to the door monitor.
These functions are compatible with both the Bob Wescott Door Monitor
and the GMon Door Monitor.
All file access is done using SHARE.EXE compatible file access so as to
remain compatible in a multi-user environment.
The following section will detail all the door monitor functions in the
library. Note that some of these functions may be there as support for
other functions.
77
MON_READ
--------
* Summary
int mon_read(node); /* Read in the monitor info */
int node; /* RBBS node number */
* Description
This function will read in the file 'TIMEOFFx.DOR' which is expected to
reside the current DOS directory. The 'x' represents the node number
and is compatible with both of the door monitors. All appropriate
information is stored in the DM data structures beginning with 'mon_'.
Next, all of the DM data structures beginning with 'user_' are filled
in from this information.
Note that no node information is available from the door monitor. You
will therefore need to set the following DM data structures to some
default value:
bbs_node_info.snoop
' 0' = no echo to local display
' 1' = echo to local display
bbs_node_info.sysop_avail
' 0' = disallow paging
' 1' = allow paging during sysop hours
bbs_node_info.sysop_annoy
' 0' = normal paging (check hours)
' 1' = always allow paging
* Return Value
0 is returned if the monitor is not active.
1 is returned if the files were successfully read and the monitor
has been flagged active (DM data structure 'mon_active' is set to
1
78
* Example
#include "dmfunc.h"
int rtc; /* return code value */
int node; /* current node */
/*
* Read in the door monitor information
*/
node = atoi(argv[1]); /* get node number from cmd line */
if (mon_read(node)) { /* read mon information */
if (mon_player(user_name, mon_user)) {
report_error("Error - Can't locate NAMES.DOR\r\n");
exit(1);
}
} else {
report_error("Error - Can't locate TIMEOFFx.DOR\r\n");
exit(1);
}
/*
* Set NODE info to defaults
*/
bbs_node_info.snoop[0] = ' '; /* allow snoop */
bbs_node_info.snoop[1] = '1';
bbs_node_info.sysop_avail[0] = ' ';
bbs_node_info.sysop_avail[1] = '0';/* no paging */
bbs_node_info.sysop_annoy[0] = ' ';
bbs_node_info.sysop_annoy[1] = '0';
/*
* At this point all is OK
*/
print_string("Welcome, ");
print_string(user_name);
print_string(", to the game.\r\n");
79
MON_WRITE
---------
* Summary
int mon_write(node, points); /* Write out the monitor info */
int node; /* RBBS node number */
int points; /* Points to add to monitor score */
* Description
This function will write out the file 'POINTSx.DOR' which will be
created in the subdirectory specified by the DM data structure
'mon_dir' (which is filled in by the 'mon_read' function. The 'x'
represents the node number and is compatible with both of the door
monitors. This file is used to return the time the game was exited,
and the number of points to add to the door monitor score as a result
of having used your door. This point value is arbitrary and you may
decide on whatever value you feel is fair.
This function returns with no action taken if the DM data structure
'mon_active' is 0 indicating that the monitor is not in use.
* Return Value
This function always returns 0.
* Example
#include "dmfunc.h"
int node; /* current node */
int score; /* today score */
int node_save; /* node saved from command line */
int old_score; /* previous days score */
int new_score; /* score as result of today */
/*
* Write out timeoff and today score
* if the monitor was active.
*/
node = node_save; /* get node number from back */
score = new_score - old_score; /* award user difference */
mon_write(node, score); /* write mon information */
mon_exit(node); /* exit via monitor if active */
exit(0); /* else exit normally */
80
MON_PLAYER
----------
* Summary
int mon_player(name, user); /* Read in the player info */
char *name; /* Place to store name */
int user; /* Monitor user # */
* Description
This function will read in the file 'NAMES.DOR' which is expected to
reside in the directory specified by the DM data structure 'mon_dir'
(which is filled in by the function 'mon_read'). The users name is
extracted and stored in the string pointed to by the 'name' parameter.
Note that door monitor user number (stored in the DM data structure
'mon_user') is read in by the function 'mon_read'.
* Return Value
0 is returned if the function completed successfully. 1 is returned if
the file NAMES.DOR cannot be located or read. 2 is returned if the
monitor is not active.
* Example
See mon_read for example of how to use mon_player.
81
MON_EXIT
--------
* Summary
int mon_exit(node); /* Exit back to door monitor */
int node; /* RBBS node number */
* Description
This function will exit back to the door monitor provided the door
monitor is active. The door monitor is expected to reside in the
directory specified by the DM data structure 'mon_dir' which is filled
in by 'mon_read'.
This function returns with no action taken if the DM data structure
'mon_active' is 0 indicating that the monitor is not in use.
* Return Value
This function always returns 0.
* Example
#include "dmfunc.h"
int node; /* current node */
int score; /* today score */
int node_save; /* node saved from command line */
int old_score; /* previous days score */
int new_score; /* score as result of today */
/*
* Write out timeoff and today score
* if the monitor was active.
*/
node = node_save; /* get node number from back */
score = new_score - old_score; /* award user difference */
mon_write(node, score); /* write mon information */
mon_exit(node); /* exit via monitor if active */
exit(0); /* else exit normally */
82
Time services
-------------
The time monitor services provide a simple to access a set of functions
related to time and to functions for controlling the amount of time the
user may have in the program being run.
The time controls apply to the time of day and to the users security
level. The program TIMEGEN.EXE is supplied with this library and may
be distributed freely along with amy software you write. This program
will convert a text file into a time control data file. The sample
file TIME.DEF is also supplied with the libraries and may also be
distributed at no charge.
83
SLEEP
-----
* Summary
int sleep(count); /* Sleep for count seconds */
int count; /* Number of seconds to sleep */
* Description
This function will pause the program for a period approximating the
count value passed in. It is not the ultimate in accuracy, but for the
most part will be acurate to plus or minu .5 seconds.
* Return Value
This function always returns 0.
* Example
#include "dmfunc.h"
/*
* Wait after printing a message
*/
print_string("Please wait..."); /* Print the wait message */
sleep(5); /* Delay */
backup(14); /* Erase the message */
84
GET_DATE
--------
* Summary
int get_date(dtstring); /* Return current date */
char dtstring[12]; /* String to hold date */
* Description
This function will return the date in Mon DD YYYY format where both the
day and year values are number string characters, and the month value
will be one of the following: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug,
Sep, Oct, Nov, or Dec.
* Return Value
This function always returns 0.
* Example
#include "dmfunc.h"
char dtstring[12]; /* String to receive date */
/*
* Get and show current date
*/
get_date(dtstring); /* Get the date */
print_string("Todays date: "); /* Now display it */
print_string(dtstring);
85
CVT_DAYS
--------
* Summary
long cvt_days(dtstring); /* Return current date as numeric */
char dtstring[12]; /* String to hold date */
* Description
This function will convert the date string passed in into "the number
of days since Jan 01 0000. It is not totally accurate in that leap
years are not taken into account, but works satisfactorally for testing
how long it has been since a user was last on.
* Return Value
This function always returns the converted value as a long
* Example
#include "dmfunc.h"
long cvt_days(); /* Return numeric date value */
char msg[32]; /* Work string */
char ldstring[12]; /* Date last time on */
char dtstring[12]; /* String to receive date */
long ltemp, ltem1; /* Work variables */
/*
* Show how long since last on
*/
get_date(dtstring); /* Get the date */
ltemp = cvt_days(ldstring); /* Compute last access date */
ltemp1 = cvt_days(dtstring); /* Compute todays date */
sprintf(msg, "It has been %ld days since last time on.",
ltemp1 - ltemp);
print_string(msg);
86
CUR_TIME
--------
* Summary
long cur_time(tmstring); /* Return current time */
* Description
This function will return the time as a long. The time is returned as
the number of seconds past midnight.
* Return Value
Returns the number of seconds past midnight.
* Example
#include "dmfunc.h"
long cur_time(); /* Time function */
long time_val; /* The time itself */
char msg[80]; /* Work buffer */
/*
* Get and show current time
*/
time_val = cur_time(); /* Get the time */
sprintf(msg, "It is now %ld seconds after Midnight.\r\n");
print_string(msg);
87
CVT_TIME
--------
* Summary
long cvt_time(tmstring); /* Return time as secs past Midnight */
char tmstring[9]; /* String to hold time */
* Description
This function will convert the time string passed in into the function
into the number of seconds past midnight. This value will be as acurate
as your system clock. The time is returned as a long.
* Return Value
This function returns the converted string as a long
* Example
#include "dmfunc.h"
long cvt_days(); /* Return numeric date value */
char msg[32]; /* Work string */
char tmstring[12]; /* String to receive time */
long ltemp; /* Work variable */
/*
* Show how long after 12 midnight
*/
get_time(tmstring); /* Get the time */
ltemp = cvt_time(tmstring); /* Compute the current value as secs */
sprintf(msg, "It is now %ld seconds after Midnight.", ltemp);
print_string(msg);
88
TEST_TIMEOUT
------------
* Summary
int test_timeout(); /* Test for time errors */
* Description
This function will test for two sepecific timeout conditions. The
first condition is a time warning and indicates that the user has less
than five minutes of time remaining. The time warning will only be
issued once. The second condition is a time error. This indicates
that the user has used all of the time available to him for this
program.
The timeout conditions are computed by comparing the current time to
that of the time count stored in user_signoff. It is important to
realize that if the user_signoff value must always be greater than the
user_signon data structure. This may be guaranteed by checking and
adding the number of seconds in a day to user_signoff if it is less
than user_signon. This guarantees to avoid problems if the user is on
while time wraps past midnight. All BBS and Door Monitor functions
make this adjustment to user_signoff when it is initially set.
This function is automatically called by both io_tests() and io_input()
and the appropriate values are passed back to the caller.
* Return Value
0 is returned if there is no timeout condition.
-1 is returned if there is a time warning condition.
-2 is returned if there is a time error condition.
* Example
#include "dmfunc.h"
/*
* Test if time problems
*/
st = time_warning(); /* Test for time problems */
if(st == -2) /* Time error condition */
{
print_string("Error - you have used all of your connect time!/007");
sleep(3);
exit(1);
}
if(st == -1) /* Time warning condition */
{
print_string("Warning, less than 5 mintutes remaining...\007");
sleep(3);
backup(42);
}
89
TIME_CONTROLS
-------------
* Summary
int time_controls(filename); /* Test for time errors */
char *filename; /* Name of time definition file */
* Description
This function will attempt to open the specified time control file. If
the file cannot be found, then the bbs_time_info sysop structures are
set to the entire 24 hour hour period and the user_access_level is set
to -1.
If the file is found, then its contents are read into the bbs_time_info
data structure. Next the structure is search to see if it will allow
access to this user based on his security stored in the data structure
user_security. An error is returned if he has too low a level. If he
has sufficient sucurity, then his user_access_level is set to the
highest value based on the contenets of user_security. Next, the time
tables are searched to find the corresponding entry in the time table
to use. This is based on the data structure user_start which should
have been set to the current time when the BBS files were read. The
user_signoff is then adjusted if the time limit indicated in the time
tables indicates that user_signoff is too high.
* Return Value
1 is returned if the time definition file is read and the user
is found to have sufficient security to access the system.
0 is returned if the time definition file cannot be found.
-1 is returned if there is an error reading the time definition
file.
-2 is returned if the user has insufficient security to access
the system.
-3 is returned if the user has insufficient security to access
the system during this time window.
90
* Example
#include "dmfunc.h"
int st; /* Work variable */
/*
* Open time controls and test for lack of security
*/
st = time_controls("GAME.TIM"); /* Test for time problems */
switch(st) /* Dispatch based on return code */
{
case -3: /* Insufficient security for time window */
print_string("Error - Insufficient security at this time.");
print_string("\r\n");
print_string(" Try again later./r/n");
sleep(3);
exit(1);
break;
case -2: /* Insufficient security */
print_string("Error - Insufficient security!\r\n");
print_string(" Check with SysOp./r/n");
sleep(3);
exit(1);
break;
case -1: /* Bad read of file */
report_error("Error - Reading time definitions");
sleep(3);
break;
case 0: /* File is not being used */
break;
case 1: /* All is OK */
break;
}
91
DAILY_CONTROLS
--------------
* Summary
int daily_controls(); /* Test daily conditions */
* Description
This function will test for daily controls based on the settings in the
time definition file. The time_controls function must be called first.
If the user_access_level is set to -1 (indicating no time controls file
was found), then the function will simply return.
If the file was found, then a series of test are performed to determine
if the user should be allowed access. First the contents of the
user_game_date data structure are compared to the current date to see
if the user has been on during this day. If they are different, then
the current date is copied into user_game_date, and the contents of
user_day_time and user_day_games are cleared, and the function returns
with no error.
If the two dates match indicating he has already been on during this
day, the a test is made to see if the user is required to be off a
particular amount of time before reentering the program. The data
structure user_game_end should contain the last time the user exitied
the program today. This value is stored as 'number of seconds after
midnight'. The current time is checked to see if he has waited long
enough and an error is returned if not.
If there is no wait period or if the user has waited long enough, then
the time definition values are checked to see if there is a maximum
number of times that a user of his user_access_level may enter the
program each day. The data structure user_day_games should contain the
number of times the user has been on that day. An error is returned if
the user has been on too many times.
If there is no daily game limit or if the user has not exceeded it,
then a check is made to see if the user has exceeded the maximum number
of minutes he is allowed on each day. The data structure user_day_time
should contain the number of minutes the user has been on that day. It
is compared to the maximum allowed in the tables for the users access
level, and if he has exceeded the limit an error is returned.
If there is no daily limit, then the function returns without error.
If there is a daily limit, and the user has not exceeded it, then the
amount of time remaining in the day is computed and the value of the
data structure user_signoff is modified as required.
* Return Value
0 is returned if there are no error conditions.
-1 is returned if the user has not waited the required amount of
time between accesses.
-2 is returned if the user has exceeded the maximum times that he
may enter the program each day.
-3 is returned if the user has exceeded the maximum number of time
he may acces the program each day.
92
* Example
#include "dmfunc.h"
int st; /* Work variable */
/*
* Open time controls and test for lack of security
*/
st = time_controls("GAME.TIM"); /* Test for time problems */
switch(st) /* Dispatch based on return code */
{
case -3: /* Insufficient security for time window */
print_string("Error - Insufficient security at this time.");
print_string("\r\n");
print_string(" Try again later./r/n");
sleep(3);
exit(1);
break;
case -2: /* Insufficient security */
print_string("Error - Insufficient security!\r\n");
print_string(" Check with SysOp./r/n");
sleep(3);
exit(1);
break;
case -1: /* Bad read of file */
report_error("Error - Reading time definitions");
sleep(3);
break;
case 0: /* File is not being used */
break;
case 1: /* All is OK */
break;
}
93
/*
* Test daily controls
*/
st = daily_controls(); /* Test for time problems */
switch(st) /* Dispatch based on return code */
{
case -3: /* Exceeded daily time limit */
print_string("Error - You have you all of your daily time.");
print_string("\r\n");
print_string(" Try again tomorrow./r/n");
sleep(3);
exit(1);
break;
case -2: /* Exceeded daily entry limit */
print_string("Error - Daily run limit exceeded!\r\n");
print_string(" Try again tomorrow./r/n");
sleep(3);
exit(1);
break;
case -1: /* Isufficient wait */
report_error("Error - You must wait longer before you can");
print_string("\r\n");
print_string(" enter program, try later./r/n");
sleep(3);
exit(1);
break;
case 0: /* All is OK */
break;
}
.
.
.
/*
* Finished for the day
*/
user_day_games++;
user_game_end = cur_time();
user_day_time += cur_time - user_start;
94
Time Control File Format
------------------------
This section show the format of the time control file and explain the
various fields. The format of this file along with the descriptions
and the program TIMEGEN.EXE may be distributed with your application.
The time definition file is an ASCII file used to create the time
control data file. It has the following format:
:SYSOP 1000 2330 ; Sysops hours
:LEVEL 006 007 008 008 008 008 008 008 ; Level access classes
:DAYT 000 000 000 000 000 000 000 000 ; Daily time limits
:DAYG 001 002 003 003 003 003 003 003 ; Daily game limits
:WAIT 000 030 030 000 000 000 000 000 ; Time between games
:TIME 0000 060 060 060 060 060 060 060 120 ; Per game access
:TIME 0600 000 030 030 030 030 030 030 030 ; Per game access
.
.
.
:TIME 2000 000 045 045 045 045 045 045 060 ; Per game access
The first entry defines the SysOp hours. This controls when the player
may use the page command. These entires are expressed as HHMM. The
second entry may be smaller than the first. As an example ":SYSOP 0700
1900" allows the player to use the page command from 7am until 7pm. The
entry ":SYSOP 2200 0200" allows the page command to be used between
10pm and 2am.
The ":LEVEL" entry defines how different security level users have
access to the game. This line consists of 8 entries in ascending
order. Each entry corresponds to a game control level. As an example
let us consider the following entry:
":LEVEL 010 020 030 040 050 060 070 080".
Any user with a security level of less than 10 would not have access to
the game. Users with security level 10 through 19 would have level 0
privelidges. Users with security level 20 through 29 would have level
1 privelidges, etc. Priveledges are explained below.
The ":DAYT" entry defines the maximum time in minutes each privelidge
level may play the game per day. This entry consists of 8 values each
corresponding to a privelidge level in ascending order. Each value is
in minutes. A value of 0 represents no daily time limit for that
particular privelidge level.
95
The ":DAYG" entry defines the maximum number of times the user may
enter the game on a given day. It consists of 8 values each one
corresponds to a privelidge level in ascending order. A value of 0
represents no game limit for that particular privelidge level.
The ":WAIT" entry defines the amount of time in minutes each user must
wait between entering the game. This entry consists of 8 values each
corresponding to a privelidge level in ascending order.
The ":TIME" entries define the amount of time each user may spend
during a single play session. It consists of 9 values. The first is
the time of day the period starts. The remaining 8 are the game time
limits for each of the 8 privelidge levels. Time limits are in minutes.
A 0 value here means that the user may not play the game during that
time period. Each ":TIME" entry must be in ascending time of day order.
There may be a maximum of 8 ":TIME" entries.
96
Running TIMEGEN.EXE
-------------------
This section explains how to run the time control file generation
program. The program takes the ASCII time control definition file and
outputs a binary file for use by the TIME_CONTROLS and DAILY_CONTROLS
functions.
To build the time control file, the following command line is used:
TIMEGEN def_file time_file
Where def_file is the ASCII file defining all time controls and
time_file is the output file that the application will read. As an
example, to provide time controls for the MSTRMIND sample program, the
following command line would be used:
TIMEGEN times.def mstrmind.tim
97
Data Structures
---------------
This section will deal with the data structures used by the DM library
functions. These fall into three major catagories: file access data
structures, BBS access data structures, and user data structures.
For the most part, many of the BBS access structures are only used by
the DM library as temporary locations to read in the BBS information.
The information is then transfered to the user data structures. Only
the data structures relevant to the operation of the library functions
will be described in detail.
98
File Access Structures
----------------------
This section will deal with those structures used the accedd the shared
file functions provided in the library. The following is an example of
the file access structure and the associated defined values used to
access the library functions:
/*
*
* File Access Structures
*
*/
struct fs /* FILE ACCESS INFORMATION */
{
char name[80]; /* filename */
int fh; /* file handle */
FILE *fd; /* file descriptor */
int open_flag; /* open flag */
int binary; /* open in binary mode */
int hold_flag; /* previous open flag */
int hold_mode; /* previous text/binary */
long hold_pos; /* previous position */
};
The name field bust be filled in by the application program. It should
under normal circumstances not contain any wilcard characters. The
file handle and file descritor fields are filled in by the FILE_OPEN
and FILE_CHANGE and FILE_RESET functions. They be referenced at any
time the file is open to perform shared file I/O using the appropriate
field for either stream or direct file access. Microsoft recommends
that most shared access be limited to direct file access.
The remaining fields are used to store information relevant to the file
between calls to the file access functions. These fields are for use
by the library functions.
/*
*
* File Access Definitions
*
*/
#define FS struct fs
#define FREAD 0
#define FMODIFY 1
#define FAPPEND 2
#define FWRITE 3
#define FTEXT 0
#define FBINARY 1
#define FNOCREATE 0
#define FCREATE 1
These definitions provide a way of using defined values as parameters
to the library functions. There meaning is apparent.
99
BBS Access Structures
---------------------
This section will deal with those structures used to access the BBS
files and to control node configuration during application runs. Most
of these structures are only used temporarily in order to read in the
BBS configuration information and then their information is copied to
the user data structures.
The following examples show the various data structures. A few also
contain descriptions about the structures where it is relevant to the
application or the running of the library.
/*
*
* RBBS Node structures
*
*/
struct bbs_node /* NODE INFORMATION */
{
char name[31]; /* Last users name */
char sysop_avail[2]; /* SysOp available flag */
char sysop_annoy[2]; /* SysOp annoy flag */
char sysop_next[2]; /* SysOp next on system flag */
char line_printer[2]; /* Line printer avail flag */
char doors_avail[2]; /* DOORS available flag */
char eight_bits[2]; /* Eight bit transmit flag */
char baud_rate[2]; /* Baud rate */
char upper_case[2]; /* Upper case only flag */
char reserve_1[5]; /* Reserved */
char graphics_type[2]; /* Graphics type flag */
char sysop[2]; /* User is SysOp flag */
char active[1]; /* Activity flag */
char snoop[2]; /* Snoop indicator */
char baud_dial[2]; /* Dialed in baud rate */
char reserved_2[2]; /* Reserved */
char login_time[6]; /* Time logged onto system */
char reserved_3[2]; /* Reserved */
char private_door[2]; /* Access to private DOOR */
char transfer[2]; /* Transfer function */
char daily_exit_date[10]; /* Last daily exit date */
char daily_exit_time[5]; /* Last daily exit time */
char reliable[2]; /* Reliable mode */
char reserved_4[36]; /* Reserved */
};
96
The bbs_node structure contains all of the configuration information
for the BBS under which the application is running. Although this is
an RBBS structure, it applies to all library functions as information
pertaining to other BBS nodes is copied into this structure.
Three fields are of interest here. The sysop_avail and sysop_annoy
fields control whether or not the PAGE_OPERATOR function will allow the
user to page the local operator. The local function keys supported by
LOCAL_INPUT will effect the contents of these two fields.
The third field of interest is the snoop field which controls whether
or not the output is echoed to the local display. The functions keys
relating to snoop in LOCAL_INPUT will modify the contents of this field
value.
struct bbs_options /* USER OPTION INFORMATION */
{
int logins; /* Times logged on */
int last_msg; /* Last message read */
char protocol[1]; /* Transfer protocol */
char graphics[1]; /* Graphics mode */
int margins; /* Margin size */
int bit_flags; /* Access options */
int subscription; /* Date subscription started */
char page_length; /* Page length (binary) */
char reserved[1]; /* Reserved */
};
/*
*
* RBBS Node option definitions
*
*/
#define BBS_OPTION_BIT_15 0x8000
#define BBS_OPTION_BIT_14 0x4000
#define BBS_OPTION_BIT_13 0x2000
#define BBS_OPTION_BIT_12 0x1000
#define BBS_OPTION_BIT_11 0x0800
#define BBS_OPTION_BIT_10 0x0400
#define BBS_OPTION_BIT_9 0x0200
#define BBS_OPTION_QUESTIONARE 0x0100
#define BBS_OPTION_AUTODOWN 0x0080
#define BBS_OPTION_FILES 0x0040
#define BBS_OPTION_BULLETINS 0x0020
#define BBS_OPTION_LF 0x0010
#define BBS_OPTION_CASE 0x0008
#define BBS_OPTION_NULLS 0x0004
#define BBS_OPTION_EXPERT 0x0002
#define BBS_OPTION_BELL 0x0001
97
/*
*
* RBBS User structure
*
*/
struct bbs_user /* USER INFORMATION */
{
char name[31]; /* Users name */
char password[15]; /* Users password */
int security; /* Security level */
struct bbs_options options; /* User options */
char residence[24]; /* City and state */
char reserved[19]; /* Reserved */
char last_on[14]; /* Date & time last on */
char last_dir[3]; /* Date last listed directory*/
int downloads; /* Total downloads */
int uploads; /* Total uploads */
int elapsed; /* Elapsed time user was on */
};
/*
*
* RBBS 16.x DORINFOx.DEF file format
*
*/
/* Line 1 --> Name of RBBS system */
/* Line 2 --> SysOps first name */
/* Line 3 --> SysOps last name */
/* Line 4 --> Comm port name */
/* Line 5 --> Comm port parameters */
/* Line 6 --> Network type */
/* Line 7 --> Users first name */
/* Line 8 --> Users last name */
/* Line 9 --> Users city/state */
/* Line 10 --> Graphics */
/* Line 11 --> Security level */
/* Line 12 --> Time remaining in minutes */
98
/*
*
* PC-Board 12.1 BBS control structure
*
*/
struct pcbbs_data /* PC-BOARD BBS INFORMATION */
{
char display[2]; /* Display On/Off (-1/0) */
char printer[2]; /* Printer On/Off (-1/0) */
char page_bell[2]; /* Page Bell On/Off (-1/0) */
char caller_alarm[2]; /* Caller Alarm On/Off (-1/0)*/
char sysop_next[2]; /* Sysop Next-On Flag */
char bps[4]; /* CONNECT bps rate of caller*/
char name[27]; /* Name of caller plus 2 spcs*/
char first[15]; /* Callers first name padded */
char graphics[2]; /* Graphics Mode (-1/0) */
char password[12]; /* Password of caller */
int user_index; /* User's Record # in DBase */
long connect_time; /* Time logged on in seconds */
long max_time; /* Allowed time in seconds */
long door_time; /* Time Exited to DOOR in sec*/
char logon[5]; /* Time logged on (hh:mm) */
int conference; /* Confer. exited to DOS from*/
int conf_flags; /* Conf. 1-9 "joined flags" */
int conf_time; /* Conference Time Add */
char dload_limit[8]; /* Daily Download Byte Limit */
int uload_credit; /* Upload time credit */
char language[4]; /* Language beging used */
char ecr_modem[2]; /* Error Corr. Modem (-1/0) */
char chat; /* Last Node CHAT Flag Status*/
};
99
/*
*
* PC-Board 14.0 BBS control structure
*
*/
struct pcbbs2_data /* PC-BOARD 14.0 INFORMATION */
{
char display[2]; /* Display On/Off (-1/0) */
char printer[2]; /* Printer On/Off (-1/0) */
char page_bell[2]; /* Page Bell On/Off (-1/0) */
char caller_alarm[2]; /* Caller Alarm On/Off (-1/0)*/
char sysop_next; /* Sysop Next-On Flag */
char ecr_modem[2]; /* Error Corr. Modem (-1/0) */
char graphics; /* Graphics Mode (1/0) */
char chat; /* Last Node CHAT Flag Status*/
char bps_open[5]; /* OPEN bps rate of caller */
char bps[5]; /* CONNECT bps rate of caller*/
int user_index; /* User's Record # in DBase */
char first[15]; /* Callers first name padded */
char password[12]; /* Password of caller */
int connect_time; /* Time logged on in minutes */
char logon[5]; /* Time logged on (hh:mm) */
int max_time; /* Daily time limit in mins */
int dload_limit; /* Daily Download Byte Limit */
char conference; /* Confer. exited to DOS from*/
char conf_flags[5]; /* Conf. 1-9 "joined flags" */
char conf_scans[5]; /* Conf. 1-9 "scanned flags" */
int conf_time; /* Conference Time Add */
int uload_credit; /* Upload time credit */
char language[4]; /* Language beging used */
char name[25]; /* Name of caller plus 2 spcs*/
int time_left; /* Session time remaining */
char node; /* Node id */
char event_time[5]; /* Next event time */
char event_flag[2]; /* Event active flag */
char event_move[2]; /* Delay event till logoff? */
long msg_memory; /* Memorized message number */
char comm_port; /* Comm port number */
char reserved[4]; /* Reserved for future use */
};
These structure contains the information passed to the door by PCBOARD
via the PCBOARD.SYS file. This information is examined and then copied
into the bbs_node structure and the appropriate user structures.
100
/*
*
* Wildcat BBS CALLINFO.BBS file format
*
*/
/* Line 1 --> User name */
/* Line 2 --> baud rate 0=2400,1=300,2=1200,3=9600 */
/* Line 3 --> User city and state */
/* Line 4 --> User Access level */
/* Line 5 --> Logon time left in minutes */
/* Line 6 --> Either COLOR or MONO user setting */
/* Line 7 --> User password */
/* Line 8 --> User Record number */
/* Line 9 --> Total minutes on bbs */
/* Line 10 --> Time entered door hh:mm */
/* Line 11 --> Time called bbs hh:mm */
/* Line 12 --> User confernces join */
/* Line 13 --> User daily d/l total */
/* Line 14 --> User max d/l per day */
/* Line 15 --> User daily d/l no of bytes in k */
/* Line 16 --> User max d/l in k */
/* Line 17 --> User phone number */
/* Line 18 --> Time / date last call */
/* Line 19 --> Either NOVICE or EXPERT - user mode */
/* Line 20 --> N=none, X=Xmodem, C=Xmodem/crc etc */
/* Line 21 --> Last new file search MM/DD/YY */
/* Line 22 --> User total number of call */
/* Line 23 --> User line per page or screen */
/* Line 24 --> Last msg no read */
/* Line 25 --> User total u/l since first log-on */
/* Line 26 --> User total d/l since first log-on */
/* Line 27 --> Either 7 {Databits} or 8 {Databits} */
/* Line 28 --> Either LOCAL or REMOTE */
/* Line 29 --> Comm port ID. */
/* Line 30 --> User birthdate */
/* Line 31 --> TRUE/FALSE */
/* Line 32 --> Normal connection */
/* Line 33 --> Time & Date door entered */
/* Line 34 --> # */
/* Line 35 --> Door id number */
The CALLINFO.BBS file is read in one line at a time and the information
is stored in the appropriate bbs_node structure field or the user
data structure.
101
/*
*
* GAP BBS DOOR.SYS file format
*
*/
/* Line 1 --> Comm port (COM0 = local) */
/* Line 2 --> baud rate 300 - 38000 */
/* Line 3 --> Parity 7 - 8 */
/* Line 4 --> Node number 1 - 99 */
/* Line 5 --> Host modem locked flag Y - N */
/* Line 6 --> Screen display Y - N */
/* Line 7 --> Printer toggle Y - N */
/* Line 8 --> Page bell Y - N */
/* Line 9 --> Caller alarm Y - N */
/* Line 10 --> User full name */
/* Line 11 --> User city and state */
/* Line 12 --> Home phone number */
/* Line 13 --> Work/data phone number */
/* Line 14 --> User password */
/* Line 15 --> User security level */
/* Line 16 --> Total times on BBS */
/* Line 17 --> Last date user called BBS */
/* Line 18 --> Seconds remaining this call */
/* Line 19 --> Minutes remaining this call */
/* Line 20 --> Graphics mode GR, NG, 7E */
/* Line 21 --> Page length */
/* Line 22 --> User expert flag Y - N */
/* Line 23 --> Conferences registered in */
/* Line 24 --> Conference exited door from */
/* Line 25 --> User expiration date */
/* Line 26 --> Users file record number */
/* Line 27 --> Default xfer protocol */
/* Line 28 --> Total uploads */
/* Line 29 --> Total downloads */
/* Line 30 --> Daily download K total */
/* Line 31 --> Daily download max K */
The DOOR.SYS file is read in one line at a time and the information is
stored in the appropriate bbs_node structure field or the user data
structure.
102
/*
*
* WWIV BBS CHAIN.TXT file format
*
*/
/* Line 1 --> User number */
/* Line 2 --> Users alias */
/* Line 3 --> Users real name */
/* Line 4 --> Amateur radio callsign */
/* Line 5 --> Age */
/* Line 6 --> Sex (M/F) */
/* Line 7 --> Gold (game credits) */
/* Line 8 --> Last date on BBS */
/* Line 9 --> Width of screen */
/* Line 10 --> Lines in screen */
/* Line 11 --> Security level */
/* Line 12 --> SysOp flag */
/* Line 13 --> Co-SysOp flag */
/* Line 14 --> ANSI graphics flag */
/* Line 15 --> Remote user flag */
/* Line 16 --> Time remaining in seconds (float) */
/* Line 17 --> General text file directory */
/* Line 18 --> Data file directory */
/* Line 19 --> Path/Filename for text sysop log */
/* Line 20 --> Current baud rate (KB = local) */
/* Line 21 --> Comm port number */
The CHAIN.TXT file is read in one line at a time and the information is
stored in the appropriate bbs_node structure field or the user data
structure.
103
/*
*
* Time control structures
*
*/
struct bbs_access /* TIME OPTION INFORMATION */
{
long start_time; /* Start of game period */
int levels[8]; /* Play times per level */
};
The bbs_access structure contains time limits for each access level by
start time.
struct bbs_time /* TIME OPTION INFORMATION */
{
long sysop_start; /* SysOp starting time */
long sysop_stop; /* SysOp ending time */
int levels[8]; /* Security levels */
int dayt[8]; /* Daily time limits */
int dayg[8]; /* Daily game limits */
int wait[8]; /* Time between games */
struct bbs_access access[8]; /* Times for play */
};
The bbs_time structure contains the information read in from the time
control file (times.DEF). It is used by the TIME_CONTROLS and
DAILY_CONTROLS functions to determine if the user may validly enter the
door application.
104
/*
*
* Global Data Section
*
*/
/* Remote User Data */
FILE *remote_io; /* Comm port stream */
int remote_user; /* Comm port number */
The remote user data controls the virtual I/O in the library functions.
The remote_io file descriptor is no longer used. The remote user data
reflects the comm port number or contains 0 if running local.
The application program may wish to control certain operations based on
on the contents of this flag (ie. only output a bulletin file if running
remotely).
/* BBS Data */
int bbs_active; /* BBS active */
char bbs_dir[]; /* BBS home directory */
struct bbs_node bbs_node_info; /* BBS node information */
struct bbs_user bbs_user_info; /* BBS user information */
struct pcbbs_data pcbbs_user_info; /* PCBoard user information */
char ascii_user_info[35][128]; /* ASCII based user info */
struct bbs_time bbs_time_info; /* BBS time information */
The above storage reflects the previously defined data structures and
character arrays for reading the BBS text files.
105
/*
*
* Monitor Data Strutures
*
*/
FILE *mon_inp; /* Input parameters */
FILE *mon_out; /* Output parameters */
int mon_active; /* Monitor active */
long mon_signoff; /* time to signoff at */
int mon_user; /* monitor user # */
int mon_points; /* current player score */
int mon_max_play; /* time to play in mins */
int mon_nulls; /* number of nulls required */
int mon_graphics; /* monitor graphics flag */
char mon_dir[40]; /* monitor subdirectory */
char mon_sound[]; /* monitor sound flag */
The monitor data structures are used as interim locations to read the
information provided in the monitor files TIMEOFFx.DOR and NAMES.DOR.
This information is processed and stored in the appropriate bbs_node
fields and the user data structures.
106
User Data Structures
--------------------
This section will describe the user control data structures. These
data structures have a major influence in controlling the time control
functions and the virtual I/O functions.
/*
*
* User Data Strutures
*
*/
int user_node; /* users node */
char user_name[32]; /* users name */
char user_game_date[12]; /* last day user player */
long user_game_end; /* last time user played */
long user_day_time; /* time user played */
int user_day_games; /* games user played */
long user_start; /* time user started game */
long user_signon; /* time user signed on */
long user_signoff; /* time to signoff at */
int user_points; /* current player score */
int user_security; /* number of nulls required */
int user_nulls; /* number of nulls required */
int user_graphics; /* graphics flag */
int user_caps; /* caps only flag */
int user_page; /* user page length */
int user_access_level; /* user game access level */
The user data structures have the greatest effect on the operation of
the DM library funtions. The user_node and user_name values are used
primarily as reference items.
The user_game_date, user_game_end, user_day_time, user_day games fields
are related to the time controls provided by the DM library. It is the
responsibility of the application to fill in these fields.
The user_start, user_signon, and user_signoff fields are filled in by
the various BBS access functions and may be modified by the time control
functions. The user_signoff field may be modified by the application if
the application wishes to set up its own time controls above those in
the DM library. For instance an application could guarantee a maximum
of a 30 minute session using the following code example:
if((user_signoff - user_signon) > 1800L)
user_signoff = user_signon + 1800L;
This should be performed after the BBS access functions have been called
or it will have no effect.
The user_security and user_access_level are used by the library for
the time control functions.
The user_nulls, user_graphics, user_caps, and user_page values are used
by the virtual I/O functions and control things such as metered output,
ANSI sequencing for clearing the display and positioning the cursor, and
filtering of I/O characters.
107
In Closing
----------
In closing, let me say that I hope this library is of help to writing
your door applications. If you have any difficulties or would like to
report any bugs, please leave mail for the SysOp on my system, or you
may send information by mail to:
Mycroft RBBS
c/o Michael W. Bayley
P.O. Box 7672
San Jose, Ca. 95150-7672
(408)927-0105